This commit was manufactured by cvs2svn to create tag

'PUBLIC_RELEASE_000917'.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/tags/PUBLIC_RELEASE_000917@7534 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
GNUstep Maintainer 2000-09-17 14:40:56 +00:00
parent 05aab7c157
commit 3a7ab724c8
49 changed files with 1501 additions and 2901 deletions

View file

@ -19,4 +19,9 @@
- (void)awakeFromNib;
- (void)applicationDidFinishLaunching:(NSNotification *)notif;
- (void)showPrefPanel:(id)sender;
- (void)showInfoPanel:(id)sender;
@end

View file

@ -28,4 +28,16 @@
{
}
- (void)applicationDidFinishLaunching:(NSNotification *)notif
{
}
- (void)showPrefPanel:(id)sender
{
}
- (void)showInfoPanel:(id)sender
{
}
@end

View file

@ -1,133 +0,0 @@
{
"Object 1" = {elements = ("Object 2"); isa = NSMutableArray; };
"Object 2" = {className = PCAppProject; isa = IMCustomObject; realObject = "Object 3"; };
"Object 3" = {
delegate = nil;
isa = NSApplication;
keyWindow = nil;
mainMenu = nil;
mainWindow = nil;
windows = "Object 4";
};
"Object 4" = {
elements = ("Object 5", "Object 9", "Object 11");
isa = NSMutableArray;
};
"Object 5" = {
backgroundColor = "Object 8";
backingType = 0;
contentFrame = "{x = 0; y = 0; width = 256; height = 128}";
contentView = "Object 6";
frameAutosaveName = nil;
hidesOnDeactivate = NO;
initialFirstResponder = nil;
isAutodisplay = NO;
isReleasedWhenClosed = NO;
isVisible = NO;
isa = NSWindow;
level = 0;
maxSize = "{width = 3.40282e+38; height = 3.40282e+38}";
minSize = "{width = 0; height = 0}";
representedFilename = "";
styleMask = 0;
title = "";
};
"Object 6" = {
autoresizesSubviews = YES;
autoresizingMask = 0;
bounds = "{x = 0; y = 0; width = 256; height = 128}";
frame = "{x = 0; y = 0; width = 256; height = 128}";
interfaceStyle = 0;
isa = NSView;
nextKeyView = nil;
nextResponder = "Object 5";
postsBoundsChangedNotifications = YES;
postsFrameChangedNotifications = YES;
previousKeyView = nil;
subviews = "Object 7";
superview = nil;
};
"Object 7" = {elements = (); isa = NSMutableArray; };
"Object 8" = {
alpha = 1.000000;
blue = 0.666667;
brightness = 0.666667;
colorSpaceName = NSCalibratedRGBColorSpace;
green = 0.666667;
hue = 0.000000;
isa = NSColor;
red = 0.666667;
saturation = 0.000000;
};
"Object 9" = {
backgroundColor = "Object 8";
backingType = 0;
contentFrame = "{x = 0; y = 0; width = 193; height = 208}";
contentView = "Object 10";
frameAutosaveName = nil;
hidesOnDeactivate = NO;
initialFirstResponder = nil;
isAutodisplay = NO;
isReleasedWhenClosed = NO;
isVisible = NO;
isa = NSWindow;
level = 0;
maxSize = "{width = 3.40282e+38; height = 3.40282e+38}";
minSize = "{width = 0; height = 0}";
representedFilename = "";
styleMask = 0;
title = "";
};
"Object 10" = {
autoresizesSubviews = YES;
autoresizingMask = 0;
bounds = "{x = 0; y = 0; width = 193; height = 208}";
frame = "{x = 0; y = 0; width = 193; height = 208}";
interfaceStyle = 0;
isa = NSView;
nextKeyView = nil;
nextResponder = "Object 9";
postsBoundsChangedNotifications = YES;
postsFrameChangedNotifications = YES;
previousKeyView = nil;
subviews = "Object 7";
superview = nil;
};
"Object 11" = {
backgroundColor = "Object 8";
backingType = 2;
contentFrame = "{x = 221; y = 299; width = 512; height = 320}";
contentView = "Object 12";
frameAutosaveName = nil;
hidesOnDeactivate = NO;
initialFirstResponder = nil;
isAutodisplay = YES;
isReleasedWhenClosed = NO;
isVisible = NO;
isa = NSWindow;
level = 0;
maxSize = "{width = 3.40282e+38; height = 3.40282e+38}";
minSize = "{width = 514; height = 352}";
representedFilename = "";
styleMask = 14;
title = Window;
};
"Object 12" = {
autoresizesSubviews = NO;
autoresizingMask = 0;
bounds = "{x = 0; y = 0; width = 512; height = 320}";
frame = "{x = 1; y = 9; width = 512; height = 320}";
interfaceStyle = 0;
isa = NSView;
nextKeyView = nil;
nextResponder = "Object 11";
postsBoundsChangedNotifications = YES;
postsFrameChangedNotifications = YES;
previousKeyView = nil;
subviews = "Object 7";
superview = nil;
};
RootObject = {Connections = "Object 7"; Objects = "Object 1"; isa = GMModel; };
TopLevelObjects = (RootObject);
Version = 1;
}

View file

@ -40,9 +40,7 @@ PCAppProj_HEADERS= \
PCAppProj_PRINCIPAL_CLASS = PCAppProj
PCAppProj_RESOURCE_FILES = \
AppProject.gmodel \
PC.proj \
Main.gmodel \
main.m \
AppController.h \
AppController.m \

View file

@ -52,7 +52,7 @@ ADDITIONAL_CFLAGS +=
ADDITIONAL_INCLUDE_DIRS +=
# Additional LDFLAGS to pass to the linker
ADDITIONAL_LDFLAGS += -lPC
ADDITIONAL_LDFLAGS += -lProjectCenter
# Additional library directories the linker should search
ADDITIONAL_LIB_DIRS +=

View file

@ -1,436 +0,0 @@
{
"Object 1" = {elements = ("Object 2", "Object 37"); isa = NSMutableArray; };
"Object 2" = {className = NSApplication; isa = IMCustomObject; realObject = "Object 3"; };
"Object 3" = {
delegate = nil;
isa = NSApplication;
keyWindow = nil;
mainMenu = "Object 11";
mainWindow = nil;
windows = "Object 4";
};
"Object 4" = {elements = ("Object 5", "Object 9"); isa = NSMutableArray; };
"Object 5" = {
backgroundColor = "Object 8";
backingType = 0;
contentFrame = "{x = 0; y = 0; width = 256; height = 128}";
contentView = "Object 6";
frameAutosaveName = nil;
hidesOnDeactivate = NO;
initialFirstResponder = nil;
isAutodisplay = NO;
isReleasedWhenClosed = NO;
isVisible = NO;
isa = NSWindow;
level = 0;
maxSize = "{width = 3.40282e+38; height = 3.40282e+38}";
minSize = "{width = 0; height = 0}";
representedFilename = "";
styleMask = 0;
title = "";
};
"Object 6" = {
autoresizesSubviews = YES;
autoresizingMask = 0;
bounds = "{x = 0; y = 0; width = 256; height = 128}";
frame = "{x = 0; y = 0; width = 256; height = 128}";
interfaceStyle = 0;
isa = NSView;
nextKeyView = nil;
nextResponder = "Object 5";
postsBoundsChangedNotifications = YES;
postsFrameChangedNotifications = YES;
previousKeyView = nil;
subviews = "Object 7";
superview = nil;
};
"Object 7" = {elements = (); isa = NSMutableArray; };
"Object 8" = {
alpha = 1.000000;
blue = 0.666667;
brightness = 0.666667;
colorSpaceName = NSCalibratedRGBColorSpace;
green = 0.666667;
hue = 0.000000;
isa = NSColor;
red = 0.666667;
saturation = 0.000000;
};
"Object 9" = {
backgroundColor = "Object 8";
backingType = 0;
contentFrame = "{x = 0; y = 0; width = 193; height = 208}";
contentView = "Object 10";
frameAutosaveName = nil;
hidesOnDeactivate = NO;
initialFirstResponder = nil;
isAutodisplay = NO;
isReleasedWhenClosed = NO;
isVisible = NO;
isa = NSWindow;
level = 0;
maxSize = "{width = 3.40282e+38; height = 3.40282e+38}";
minSize = "{width = 0; height = 0}";
representedFilename = "";
styleMask = 0;
title = "";
};
"Object 10" = {
autoresizesSubviews = YES;
autoresizingMask = 0;
bounds = "{x = 0; y = 0; width = 193; height = 208}";
frame = "{x = 0; y = 0; width = 193; height = 208}";
interfaceStyle = 0;
isa = NSView;
nextKeyView = nil;
nextResponder = "Object 9";
postsBoundsChangedNotifications = YES;
postsFrameChangedNotifications = YES;
previousKeyView = nil;
subviews = "Object 7";
superview = nil;
};
"Object 11" = {
autoenablesItems = YES;
isa = NSMenu;
itemArray = "Object 12";
title = GNUstep;
};
"Object 12" = {
elements = (
"Object 13",
"Object 20",
"Object 27",
"Object 33",
"Object 35",
"Object 36"
);
isa = NSMutableArray;
};
"Object 13" = {
action = "submenuAction:";
image = "Object 14";
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = "";
representedObject = nil;
state = 0;
tag = 0;
target = "Object 15";
title = Info;
};
"Object 14" = {isa = NSImage; name = NSMenuArrow; size = "{width = 12; height = 9}"; };
"Object 15" = {
autoenablesItems = YES;
isa = NSMenu;
itemArray = "Object 16";
title = Info;
};
"Object 16" = {
elements = ("Object 17", "Object 18", "Object 19");
isa = NSMutableArray;
};
"Object 17" = {
action = nil;
image = nil;
isEnabled = NO;
isa = NSMenuItem;
keyEquivalent = "";
representedObject = nil;
state = 0;
tag = 0;
target = nil;
title = "Info Panel...";
};
"Object 18" = {
action = nil;
image = nil;
isEnabled = NO;
isa = NSMenuItem;
keyEquivalent = "";
representedObject = nil;
state = 0;
tag = 0;
target = nil;
title = Preferences...;
};
"Object 19" = {
action = nil;
image = nil;
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = "?";
representedObject = nil;
state = 0;
tag = 0;
target = nil;
title = Help...;
};
"Object 20" = {
action = "submenuAction:";
image = "Object 14";
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = "";
representedObject = nil;
state = 0;
tag = 0;
target = "Object 21";
title = Edit;
};
"Object 21" = {
autoenablesItems = YES;
isa = NSMenu;
itemArray = "Object 22";
title = Edit;
};
"Object 22" = {
elements = ("Object 23", "Object 24", "Object 25", "Object 26");
isa = NSMutableArray;
};
"Object 23" = {
action = nil;
image = nil;
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = x;
representedObject = nil;
state = 0;
tag = 0;
target = nil;
title = Cut;
};
"Object 24" = {
action = nil;
image = nil;
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = c;
representedObject = nil;
state = 0;
tag = 0;
target = nil;
title = Copy;
};
"Object 25" = {
action = nil;
image = nil;
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = v;
representedObject = nil;
state = 0;
tag = 0;
target = nil;
title = Paste;
};
"Object 26" = {
action = nil;
image = nil;
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = a;
representedObject = nil;
state = 0;
tag = 0;
target = nil;
title = "Select All";
};
"Object 27" = {
action = "submenuAction:";
image = "Object 14";
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = "";
representedObject = nil;
state = 0;
tag = 0;
target = "Object 28";
title = Windows;
};
"Object 28" = {
autoenablesItems = YES;
isa = NSMenu;
itemArray = "Object 29";
title = Windows;
};
"Object 29" = {
elements = ("Object 30", "Object 31", "Object 32");
isa = NSMutableArray;
};
"Object 30" = {
action = nil;
image = nil;
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = "";
representedObject = nil;
state = 0;
tag = 0;
target = nil;
title = "Arrange in Front";
};
"Object 31" = {
action = nil;
image = nil;
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = m;
representedObject = nil;
state = 0;
tag = 0;
target = nil;
title = "Miniaturize Window";
};
"Object 32" = {
action = nil;
image = nil;
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = w;
representedObject = nil;
state = 0;
tag = 0;
target = nil;
title = "Close Window";
};
"Object 33" = {
action = "submenuAction:";
image = "Object 14";
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = "";
representedObject = nil;
state = 0;
tag = 0;
target = "Object 34";
title = Services;
};
"Object 34" = {
autoenablesItems = YES;
isa = NSMenu;
itemArray = "Object 7";
title = Services;
};
"Object 35" = {
action = nil;
image = nil;
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = h;
representedObject = nil;
state = 0;
tag = 0;
target = nil;
title = Hide;
};
"Object 36" = {
action = nil;
image = nil;
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = q;
representedObject = nil;
state = 0;
tag = 0;
target = nil;
title = Quit;
};
"Object 37" = {className = AppController; isa = IMCustomObject; };
"Object 38" = {
elements = (
"Object 39",
"Object 41",
"Object 43",
"Object 45",
"Object 47",
"Object 49",
"Object 51",
"Object 53",
"Object 55",
"Object 57",
"Object 59"
);
isa = NSMutableArray;
};
"Object 39" = {
destination = nil;
isa = IMControlConnector;
label = "Object 40";
source = "Object 23";
};
"Object 40" = {isa = NSString; string = "cut:"; };
"Object 41" = {
destination = nil;
isa = IMControlConnector;
label = "Object 42";
source = "Object 24";
};
"Object 42" = {isa = NSString; string = "copy:"; };
"Object 43" = {
destination = nil;
isa = IMControlConnector;
label = "Object 44";
source = "Object 25";
};
"Object 44" = {isa = NSString; string = "paste:"; };
"Object 45" = {
destination = nil;
isa = IMControlConnector;
label = "Object 46";
source = "Object 26";
};
"Object 46" = {isa = NSString; string = "selectAll:"; };
"Object 47" = {
destination = "Object 2";
isa = IMControlConnector;
label = "Object 48";
source = "Object 36";
};
"Object 48" = {isa = NSString; string = "terminate:"; };
"Object 49" = {
destination = "Object 2";
isa = IMControlConnector;
label = "Object 50";
source = "Object 35";
};
"Object 50" = {isa = NSString; string = "hide:"; };
"Object 51" = {
destination = nil;
isa = IMControlConnector;
label = "Object 52";
source = "Object 19";
};
"Object 52" = {isa = NSString; string = "showHelp:"; };
"Object 53" = {
destination = nil;
isa = IMControlConnector;
label = "Object 54";
source = "Object 31";
};
"Object 54" = {isa = NSString; string = "performMiniaturize:"; };
"Object 55" = {
destination = nil;
isa = IMControlConnector;
label = "Object 56";
source = "Object 32";
};
"Object 56" = {isa = NSString; string = "performClose:"; };
"Object 57" = {
destination = nil;
isa = IMControlConnector;
label = "Object 58";
source = "Object 30";
};
"Object 58" = {isa = NSString; string = "arrangeInFront:"; };
"Object 59" = {
destination = "Object 37";
isa = IMOutletConnector;
label = "Object 60";
source = "Object 2";
};
"Object 60" = {isa = NSString; string = delegate; };
RootObject = {Connections = "Object 38"; Objects = "Object 1"; isa = GMModel; };
TopLevelObjects = (RootObject);
Version = 1;
}

View file

@ -10,12 +10,12 @@
FOUNDATION = "GNUSTEP-BASE";
FRAMEWORKS = ();
HEADER_FILES = ("AppController.h");
INTERFACES = ("Main.gmodel");
INTERFACES = ();
IMAGES = ();
LANGUAGE = "English";
LAST_EDITING = "";
LIBRARIES = ("gnustep-base","gnustep-gui");
MAININTERFACE = "Main.gmodel";
MAININTERFACE = "";
MAKEFILEDIR = "/usr/GNUstep/Makefiles";
INSTALLDIR = "$(HOME)/Apps";
OTHER_FILES = ();

View file

@ -77,8 +77,8 @@ static PCAppMakefileFactory *_factory = nil;
[string appendString:@"#\n\n"];
[string appendString:[NSString stringWithFormat:@"APP_NAME=%@\n",prName]];
// [string appendString:[NSString stringWithFormat:@"%@_PRINCIPAL_CLASS=%@\n",prName,[prDict objectForKey:PCPrincipalClass]]];
[string appendString:[NSString stringWithFormat:@"%@_MAIN_MODEL_FILE=%@\n",prName,[prDict objectForKey:PCMainGModelFile]]];
// [string appendString:[NSString stringWithFormat:@"%@_PRINCIPAL_CLASS=%@\n",prName,[prDict objectForKey:PCPrincipalClass]]];
//[string appendString:[NSString stringWithFormat:@"%@_MAIN_MODEL_FILE=%@\n",prName,[prDict objectForKey:PCMainGModelFile]]];
[string appendString:[NSString stringWithFormat:@"%@_APPLICATION_ICON=%@\n",prName, [prDict objectForKey:PCAppIcon]]];
[string appendString:@"#\n\n"];

View file

@ -38,8 +38,6 @@
@interface PCAppProject : PCProject
{
@private
BOOL _needsAdditionalReleasing;
}
//----------------------------------------------------------------------------

View file

@ -66,8 +66,6 @@
// [projectFileInspectorView addSubview:projectTypePopup];
[projectFileInspectorView sizeToFit];
[projectFileInspectorView setAutoresizingMask:NSViewWidthSizable];
_needsAdditionalReleasing = YES;
}
@end
@ -80,42 +78,33 @@
- (id)init
{
if ((self = [super init])) {
rootCategories = [[NSDictionary dictionaryWithObjectsAndKeys:
if ((self = [super init])) {
rootCategories = [[NSDictionary dictionaryWithObjectsAndKeys:
PCGModels,@"Interfaces",
PCImages,@"Images",
PCOtherResources,@"Other Resources",
PCSubprojects,@"Subprojects",
PCLibraries,@"Libraries",
PCDocuFiles,@"Documentation",
PCOtherSources,@"Other Sources",
PCHeaders,@"Headers",
PCClasses,@"Classes",
nil] retain];
PCImages,@"Images",
PCOtherResources,@"Other Resources",
PCSubprojects,@"Subprojects",
PCLibraries,@"Libraries",
PCDocuFiles,@"Documentation",
PCOtherSources,@"Other Sources",
PCHeaders,@"Headers",
PCClasses,@"Classes",
nil] retain];
#if defined(GNUSTEP)
[self _initUI];
#else
if(![NSBundle loadNibNamed:@"AppProject.nib" owner:self]) {
[[NSException exceptionWithName:NIB_NOT_FOUND_EXCEPTION reason:@"Could not load AppProject.gmodel" userInfo:nil] raise];
return nil;
}
#endif
}
return self;
[self _initUI];
}
return self;
}
- (void)dealloc
{
[rootCategories release];
if (_needsAdditionalReleasing) {
[projectAttributeInspectorView release];
[projectProjectInspectorView release];
[projectFileInspectorView release];
}
[super dealloc];
[rootCategories release];
[projectAttributeInspectorView release];
[projectProjectInspectorView release];
[projectFileInspectorView release];
[super dealloc];
}
//----------------------------------------------------------------------------

View file

@ -1,5 +1,104 @@
#import <AppKit/AppKit.h>
#import "AppController.h"
#define APP_NAME @"GNUstep"
/*
* Create the application's menu
*/
void createMenu();
/*
* Initialise and go!
*/
int main(int argc, const char *argv[]) {
return NSApplicationMain(argc, argv);
NSApplication *theApp;
id pool = [[NSAutoreleasePool alloc] init];
AppController *controller;
#ifndef NX_CURRENT_COMPILER_RELEASE
initialize_gnustep_backend();
#endif
theApp = [NSApplication sharedApplication];
createMenu();
controller = [[AppController alloc] init];
[theApp setDelegate:controller];
/*
* Go...
*/
[theApp run];
/*
* ...and finish!
*/
[controller release];
[pool release];
return 0;
}
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:action 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 = [[[NSMenu alloc] init] autorelease];
[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 = [[[NSMenu alloc] init] autorelease];
[edit addItemWithTitle:@"Cut" action:action keyEquivalent:@"x"];
[edit addItemWithTitle:@"Copy" action:action keyEquivalent:@"c"];
[edit addItemWithTitle:@"Paste" action:action keyEquivalent:@"v"];
[edit addItemWithTitle:@"Delete" action:action keyEquivalent:@""];
[edit addItemWithTitle:@"Select All" action:action keyEquivalent:@"a"];
[menu setSubmenu:edit forItem:[menu itemWithTitle:@"Edit"]];
windows = [[[NSMenu alloc] init] autorelease];
[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 = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:services forItem:[menu itemWithTitle:@"Services"]];
[[NSApplication sharedApplication] setMainMenu:menu];
[[NSApplication sharedApplication] setServicesMenu: services];
[menu update];
[menu display];
}

View file

@ -194,6 +194,7 @@ static NSDictionary *dict = nil;
[file rangeOfString:@"$FILENAMESANSEXTENSION$"] withString:name];
}
}
[file writeToFile:newFile atomically:YES];
[file autorelease];
}

View file

@ -36,7 +36,7 @@ PACKAGE_NAME = PCLib
LIBRARY_VAR = PCLIB
# The library to be compiled
LIBRARY_NAME=libPC
LIBRARY_NAME=libProjectCenter
PCLIB_INSTALL_PREFIX=$(GNUSTEP_LOCAL_ROOT)
@ -46,7 +46,7 @@ FILE_AUTHORS = \
# The source files
libPC_MFILES = \
libProjectCenter_MFILES = \
PCBrowserController.m \
PCBundleLoader.m \
PCDataSource.m \
@ -56,9 +56,9 @@ libPC_MFILES = \
PCProjectManager.m \
PCServer.m
libPC_CFILES =
libProjectCenter_CFILES =
libPC_HFILES = \
libProjectCenter_HFILES = \
FileCreator.h \
PCBrowserController.h \
PCBundleLoader.h \
@ -76,18 +76,18 @@ libPC_HFILES = \
ProjectType.h \
Server.h
HEADERS_INSTALL = $(libPC_HFILES)
HEADERS_INSTALL = $(libProjectCenter_HFILES)
# The Objective-C source files to be compiled
libPC_OBJC_FILES = $(libPC_MFILES)
libProjectCenter_OBJC_FILES = $(libProjectCenter_MFILES)
# The C source files to be compiled
libPC_C_FILES = $(libPC_CFILES)
libProjectCenter_C_FILES = $(libProjectCenter_CFILES)
# The headers
libPC_HEADER_FILES_DIR = .
libPC_HEADER_FILES_INSTALL_DIR = /ProjectCenter
libPC_HEADER_FILES = $(libPC_HFILES)
libProjectCenter_HEADER_FILES_DIR = .
libProjectCenter_HEADER_FILES_INSTALL_DIR = /ProjectCenter
libProjectCenter_HEADER_FILES = $(libProjectCenter_HFILES)
-include GNUmakefile.preamble

View file

@ -56,3 +56,6 @@
- (BOOL)browser:(NSBrowser *)sender selectCellWithString:(NSString *)title inColumn:(int)column;
@end
extern NSString *FileShouldOpenNotification;

View file

@ -26,14 +26,17 @@
#import "PCBrowserController.h"
#import "PCProject.h"
#import "PCFileManager.h"
NSString *FileShouldOpenNotification = @"FileShouldOpenNotification";
@implementation PCBrowserController
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
[super dealloc];
}
- (void)click:(id)sender
@ -41,45 +44,54 @@
NSTextView *pTextView;
if ([[sender selectedCell] isLeaf]) {
NSString *ltitle = [[sender selectedCell] stringValue];
NSString *ctitle = [[sender selectedCellInColumn:0] stringValue];
NSString *text = [NSString stringWithFormat:@"Display File %@",[[sender selectedCell] stringValue]
];
NSString *ctitlef = [[project projectPath] stringByAppendingPathComponent:ltitle];
pTextView = [project textView];
NSLog(@"****** %@",ctitlef);
if ([ctitle isEqualToString:@"Classes"]) {
[pTextView setString:text];
NSString *f = [NSString stringWithContentsOfFile:ctitlef];
[pTextView setString:f];
}
else if ([ctitle isEqualToString:@"Headers"]) {
NSString *f = [NSString stringWithContentsOfFile:ctitlef];
[pTextView setString:f];
}
else if ([ctitle isEqualToString:@"Other Sources"]) {
NSString *f = [NSString stringWithContentsOfFile:ctitlef];
[pTextView setString:f];
}
// This should not be needed!
[pTextView display];
}
}
- (void)doubleClick:(id)sender
{
#warning No subproject support here yet!
/*
if ([sender selectedColumn] == 0) {
// Ask the project about the valid file types
//NSArray *types = [project typesForKeyPath:[sender pathToColumn:0]];
NSOpenPanel *openPanel;
int retval;
NSArray *types;
if ([sender selectedColumn] != 0) {
NSString *category = [[[browser path] componentsSeparatedByString:@"/"] objectAtIndex:1];
NSString *k = [[project rootCategories] objectForKey:category];
openPanel = [NSOpenPanel openPanel];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setCanChooseDirectories:NO];
[openPanel setCanChooseFiles:YES];
if ((retval = [openPanel runModalForDirectory:[[NSUserDefaults standardUserDefaults] objectForKey:@"LastOpenDirectory"] file:nil types:types])) {
NSString *key = [project projectKeyForKeyPath:[sender path]];
[project addFile:[[openPanel filenames] objectAtIndex:0] forKey:key];
[[NSUserDefaults standardUserDefaults] setObject:[openPanel directory] forKey:@"LastOpenDirectory"];
}
if ([k isEqualToString:PCClasses] || [k isEqualToString:PCHeaders] || [k isEqualToString:PCOtherSources]) {
NSString *projectPath = [project projectPath];
NSString *fn = [self nameOfSelectedFile];
NSString *file = [projectPath stringByAppendingPathComponent:fn];
NSDictionary *ui =[NSDictionary dictionaryWithObjectsAndKeys:
file,@"FilePathKey",nil];
[[NSNotificationCenter defaultCenter] postNotificationName:FileShouldOpenNotification object:self userInfo:ui];
}
else {
}
*/
}
else {
[[PCFileManager fileManager] showAddFileWindow];
}
}
- (void)projectDictDidChange:(NSNotification *)aNotif
@ -101,14 +113,7 @@
- (NSString *)pathOfSelectedFile
{
NSString *path = nil;
// Doesn't work with subprojects!
if ([browser selectedColumn] != 0) {
path = [browser path];
}
return path;
return [browser path];
}
- (void)setBrowser:(NSBrowser *)aBrowser

View file

@ -32,16 +32,17 @@
id fileTypePopup;
id newFileName;
id delegate;
id fileTypeAccessaryView;
id addFileTypePopup;
id delegate; // PCProjectManager
NSMutableDictionary *creators;
BOOL _needsAdditionalReleasing;
}
//===========================================================================================
// ==== Class methods
//===========================================================================================
+ (PCFileManager *)fileManager;
//===========================================================================================
// ==== Init and free
//===========================================================================================
@ -62,7 +63,6 @@
// ==== File stuff
// ===========================================================================
- (void)fileTypePopupChanged:(id)sender;
- (void)showAddFileWindow;
- (void)showNewFileWindow;
@ -88,3 +88,6 @@
- (void)fileManager:(id)sender didAddFile:(NSString *)file forKey:(NSString *)key;
@end

View file

@ -135,33 +135,26 @@
[newFileName setStringValue:@""];
[newFileName setAutoresizingMask: (NSViewWidthSizable | NSViewMinYMargin)];
[_c_view addSubview:[newFileName autorelease]];
/*
* the accessory view needed for adding files
*
*/
fileTypeAccessaryView = [[NSBox alloc] init];
addFileTypePopup = [[[NSPopUpButton alloc] initWithFrame:NSMakeRect(20,30,160,20) pullsDown:NO] autorelease];
[addFileTypePopup addItemWithTitle:@"No type available!"];
[fileTypeAccessaryView setTitle:@"Add to category"];
[fileTypeAccessaryView setTitlePosition:NSAtTop];
[fileTypeAccessaryView setBorderType:NSGrooveBorder];
[fileTypeAccessaryView addSubview:addFileTypePopup];
[fileTypeAccessaryView sizeToFit];
[fileTypeAccessaryView setAutoresizingMask: NSViewWidthSizable];
[fileTypePopup setTarget:self];
[fileTypePopup setAction:@selector(fileTypePopupChanged:)];
_needsAdditionalReleasing = YES;
}
@end
@implementation PCFileManager
//===========================================================================================
// ==== Class methods
//===========================================================================================
static PCFileManager *_mgr = nil;
+ (PCFileManager *)fileManager
{
if (!_mgr) {
_mgr = [[PCFileManager alloc] init];
}
return _mgr;
}
//===========================================================================================
// ==== Init and free
//===========================================================================================
@ -170,15 +163,7 @@
{
if ((self = [super init])) {
creators = [[NSMutableDictionary alloc] init];
#if defined(GNUSTEP)
[self _initUI];
#else
if(![NSBundle loadNibNamed:@"FileCreation.nib" owner:self]) {
[[NSException exceptionWithName:NIB_NOT_FOUND_EXCEPTION reason:@"Could not load FileCreation.gmodel" userInfo:nil] raise];
return nil;
}
#endif
}
return self;
}
@ -186,18 +171,14 @@
- (void)dealloc
{
[creators release];
if (_needsAdditionalReleasing) {
[fileTypeAccessaryView release];
[newFileWindow release];
}
[newFileWindow release];
[super dealloc];
}
- (void)awakeFromNib
{
[fileTypePopup removeAllItems];
[fileTypePopup removeAllItems];
}
// ===========================================================================
@ -206,56 +187,53 @@
- (id)delegate
{
return delegate;
return delegate;
}
- (void)setDelegate:(id)aDelegate
{
delegate = aDelegate;
delegate = aDelegate;
}
// ===========================================================================
// ==== File stuff
// ===========================================================================
- (void)fileTypePopupChanged:(id)sender
{
}
- (void)showAddFileWindow
{
NSOpenPanel *openPanel;
int retval;
NSOpenPanel *openPanel;
int retval;
NSMutableArray *validTypes = nil;
NSDictionary *categories = nil;
PCProject *project = nil;
NSString *key = nil;
NSString *title = nil;
NSArray *types = nil;
if (delegate && [delegate respondsToSelector:@selector(fileManagerWillAddFiles:)]) {
if (!(project = [delegate fileManagerWillAddFiles:self])) {
NSLog(@"No project to add files available...");
return;
}
}
// Ask the active project for the valid file types first!
categories = [project rootCategories];
validTypes = [NSMutableArray arrayWithArray:[categories allKeys]];
[validTypes removeObject:@"Subprojects"];
[addFileTypePopup removeAllItems];
[addFileTypePopup addItemsWithTitles:validTypes];
key = [project selectedRootCategory];
title = [[[project rootCategories] allKeysForObject:key] objectAtIndex:0];
title = [NSString stringWithFormat:@"Add to %@...",title];
types = [project fileExtensionsForCategory:key];
openPanel = [NSOpenPanel openPanel];
[openPanel setAllowsMultipleSelection:YES];
[openPanel setCanChooseDirectories:NO];
[openPanel setCanChooseFiles:YES];
[openPanel setTitle:@"Add File(s)..."];
[openPanel setAccessoryView:fileTypeAccessaryView];
retval = [openPanel runModalForDirectory:[[NSUserDefaults standardUserDefaults] objectForKey:@"LastOpenDirectory"] file:nil types:nil];
[openPanel setTitle:title];
retval = [openPanel runModalForDirectory:[[NSUserDefaults standardUserDefaults] objectForKey:@"LastOpenDirectory"] file:nil types:types];
if (retval == NSOKButton) {
NSString *key = [categories objectForKey:[addFileTypePopup titleOfSelectedItem]];
NSEnumerator *enumerator;
NSString *file;
@ -263,17 +241,57 @@
enumerator = [[openPanel filenames] objectEnumerator];
while (file = [enumerator nextObject]) {
NSString *otherKey;
NSString *ext;
BOOL ret = NO;
NSString *fn;
NSString *fileName;
NSString *pth;
if ([delegate fileManager:self shouldAddFile:file forKey:key]) {
NSString *fileName = [file lastPathComponent];
NSString *pth = [[project projectPath] stringByAppendingPathComponent:fileName];
fileName = [file lastPathComponent];
pth = [[project projectPath] stringByAppendingPathComponent:fileName];
if (![key isEqualToString:PCLibraries]) {
if ([[NSFileManager defaultManager] copyPath:file toPath:pth handler:nil]) {
[delegate fileManager:self didAddFile:pth forKey:key];
if (![[NSFileManager defaultManager] fileExistsAtPath:pth]) {
[[NSFileManager defaultManager] copyPath:file toPath:pth handler:nil];
}
}
else {
[delegate fileManager:self didAddFile:pth forKey:key];
[project addFile:pth forKey:key];
}
if ([key isEqualToString:PCClasses]) {
otherKey = PCHeaders;
ext = [NSString stringWithString:@"h"];
fn = [file stringByDeletingPathExtension];
fn = [fn stringByAppendingPathExtension:ext];
if ([[NSFileManager defaultManager] fileExistsAtPath:fn]) {
ret = NSRunAlertPanel(@"Adding Header?",@"Should %@ be added to project %@ as well?",@"Yes",@"No",nil,fn,[project projectName]);
}
}
else if ([key isEqualToString:PCHeaders]) {
otherKey = PCClasses;
ext = [NSString stringWithString:@"m"];
fn = [file stringByDeletingPathExtension];
fn = [fn stringByAppendingPathExtension:ext];
if ([[NSFileManager defaultManager] fileExistsAtPath:fn]) {
ret = NSRunAlertPanel(@"Adding Class?",@"Should %@ be added to project %@ as well?",@"Yes",@"No",nil,fn,[project projectName]);
}
}
if (ret) {
if ([delegate fileManager:self shouldAddFile:fn forKey:otherKey]) {
NSString *pp = [project projectPath];
fileName = [fn lastPathComponent];
pth = [pp stringByAppendingPathComponent:fileName];
[[NSFileManager defaultManager] copyPath:fn toPath:pth handler:nil];
[project addFile:pth forKey:otherKey];
}
}
}
@ -367,3 +385,6 @@
}
@end

View file

@ -28,6 +28,19 @@
#import "ProjectBuilder.h"
#ifndef IMAGE
#define IMAGE(X) [[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:(X)]] autorelease]
#endif
#define BUILD_ARGS_KEY @"BuildArgsKey"
#define BUILD_HOST_KEY @"BuildHostKey"
#define TARGET_MAKE @"Make"
#define TARGET_MAKE_DEBUG @"MakeDebug"
#define TARGET_MAKE_PROFILE @"MakeProfile"
#define TARGET_MAKE_INSTALL @"MakeInstall"
#define TARGET_MAKE_CLEAN @"MakeClean"
#define TOUCHED_NOTHING (0)
#define TOUCHED_EVERYTHING (1 << 0)
#define TOUCHED_PROJECT_NAME (1 << 1)
@ -46,13 +59,6 @@
typedef int PCProjInfoBits;
typedef enum {
defaultTarget = 0,
debug,
profile,
install
} btarget;
//===========================================================================================
// ==== Project keys
//===========================================================================================
@ -82,7 +88,7 @@ static NSString * const PCLibraryVar = @"LIBRARY_VAR";
{
id projectWindow;
id delegate;
id projectBuilder;
id projectManager;
id browserController;
id textView;
@ -92,7 +98,8 @@ static NSString * const PCLibraryVar = @"LIBRARY_VAR";
id projectFileInspectorView;
id buildTargetPanel;
id buildTargetPopup;
id buildTargetHostField;
id buildTargetArgsField;
id buildStatusField;
id targetField;
@ -102,10 +109,10 @@ static NSString * const PCLibraryVar = @"LIBRARY_VAR";
NSMutableDictionary *projectDict;
NSDictionary *rootCategories; // Needs to be initialised by subclasses!
NSMutableDictionary *buildOptions;
@private
BOOL _needsReleasing;
btarget _buildTarget;
}
//===========================================================================================
@ -122,6 +129,9 @@ static NSString * const PCLibraryVar = @"LIBRARY_VAR";
//===========================================================================================
- (id)browserController;
- (NSString *)selectedRootCategory;
- (NSArray *)fileExtensionsForCategory:(NSString *)key;
- (void)setProjectName:(NSString *)aName;
- (NSString *)projectName;
@ -204,12 +214,12 @@ static NSString * const PCLibraryVar = @"LIBRARY_VAR";
- (id)updatedFilesView;
- (void)showBuildTargetPanel:(id)sender;
- (void)setTarget:(id)sender;
- (void)setHost:(id)sender;
- (void)setArguments:(id)sender;
- (void)build:(id)sender;
- (void)clean:(id)sender;
- (NSDictionary *)buildOptions;
@end
@ -228,3 +238,9 @@ static NSString * const PCLibraryVar = @"LIBRARY_VAR";
- (void)windowWillClose:(NSNotification *)aNotification;
@end
@interface PCProject (TextDelegate)
- (void)textDidEndEditing:(NSNotification *)aNotification;
@end

View file

@ -79,6 +79,7 @@
textView = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,472,88)];
[textView setMaxSize:NSMakeSize(1e7, 1e7)];
[textView setRichText:NO];
[textView setVerticallyResizable:YES];
[textView setHorizontallyResizable:YES];
[textView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
@ -110,27 +111,28 @@
prototype: buttonCell
numberOfRows: 1
numberOfColumns: 3] autorelease];
[matrix setIntercellSpacing:NSMakeSize(1,1)];
[matrix setSelectionByRect:YES];
[matrix setAutoresizingMask: (NSViewMaxXMargin | NSViewMinYMargin)];
[_c_view addSubview:matrix];
button = [matrix cellAtRow:0 column:0];
[button setImagePosition:NSImageOnly];
[button setImage:[[[NSImage alloc] initWithContentsOfFile:@"ProjectCentre_build.tiff"] autorelease]];
[button setImage:IMAGE(@"ProjectCentre_build")];
[button setButtonType:NSMomentaryPushButton];
[button setTarget:self];
[button setAction:@selector(build:)];
button = [matrix cellAtRow:0 column:1];
[button setImagePosition:NSImageOnly];
[button setImage:[[[NSImage alloc] initWithContentsOfFile:@"ProjectCentre_clean.tiff"] autorelease]];
[button setImage:IMAGE(@"ProjectCentre_settings.tiff")];
[button setButtonType:NSMomentaryPushButton];
[button setTarget:self];
[button setAction:@selector(clean:)];
[button setAction:@selector(showInspector:)];
button = [matrix cellAtRow:0 column:2];
[button setImagePosition:NSImageOnly];
[button setImage:[[[NSImage alloc] initWithContentsOfFile:@"ProjectCentre_prefs.tiff"] autorelease]];
[button setImage:IMAGE(@"ProjectCentre_prefs.tiff")];
[button setTarget:self];
[button setAction:@selector(showBuildTarget:)];
[button setButtonType:NSMomentaryPushButton];
@ -144,31 +146,35 @@
prototype: buttonCell
numberOfRows: 1
numberOfColumns: 4] autorelease];
[matrix setIntercellSpacing:NSMakeSize(1,1)];
[matrix setSelectionByRect:YES];
[matrix setAutoresizingMask: (NSViewMinXMargin | NSViewMinYMargin)];
[_c_view addSubview:matrix];
button = [matrix cellAtRow:0 column:0];
[button setImagePosition:NSImageOnly];
[button setImage:[[[NSImage alloc] initWithContentsOfFile:@"ProjectCentre_run.tiff"] autorelease]];
[button setImage:IMAGE(@"ProjectCentre_run.tiff")];
[button setButtonType:NSMomentaryPushButton];
button = [matrix cellAtRow:0 column:1];
[button setImagePosition:NSImageOnly];
[button setImage:[[[NSImage alloc] initWithContentsOfFile:@"ProjectCentre_uml.tiff"] autorelease]];
[button setImage:IMAGE(@"ProjectCentre_uml.tiff")];
[button setButtonType:NSMomentaryPushButton];
button = [matrix cellAtRow:0 column:2];
[button setImagePosition:NSImageOnly];
[button setImage:[[[NSImage alloc] initWithContentsOfFile:@"ProjectCentre_documentation.tiff"] autorelease]];
[button setImage:IMAGE(@"ProjectCentre_documentation.tiff")];
[button setButtonType:NSMomentaryPushButton];
button = [matrix cellAtRow:0 column:3];
[button setImagePosition:NSImageOnly];
[button setImage:[[[NSImage alloc] initWithContentsOfFile:@"ProjectCentre_find.tiff"] autorelease]];
[button setImage:IMAGE(@"ProjectCentre_find.tiff")];
[button setButtonType:NSMomentaryPushButton];
// Status
/*
* Status
*/
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(152,296,48,15)];
[textField setAlignment: NSRightTextAlignment];
[textField setBordered: NO];
@ -180,7 +186,10 @@
NSViewMinYMargin)];
[_c_view addSubview:[textField autorelease]];
// Status message
/*
* Status message
*/
buildStatusField = [[NSTextField alloc] initWithFrame:NSMakeRect(204,296,104,15)];
[buildStatusField setAlignment: NSLeftTextAlignment];
[buildStatusField setBordered: NO];
@ -193,7 +202,10 @@
NSViewMinYMargin)];
[_c_view addSubview:[buildStatusField autorelease]];
// Target
/*
* Target
*/
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(152,272,48,15)];
[textField setAlignment: NSRightTextAlignment];
[textField setBordered: NO];
@ -205,7 +217,10 @@
NSViewMinYMargin)];
[_c_view addSubview:[textField autorelease]];
// Target message
/*
* Target message
*/
targetField = [[NSTextField alloc] initWithFrame:NSMakeRect(204,272,104,15)];
[targetField setAlignment: NSLeftTextAlignment];
[targetField setBordered: NO];
@ -219,40 +234,19 @@
[_c_view addSubview:[targetField autorelease]];
/*
* Build Panel
* Build Options Panel
*
*/
_w_frame = NSMakeRect(100,100,272,104);
_w_frame = NSMakeRect(100,100,272,80);
buildTargetPanel = [[NSWindow alloc] initWithContentRect:_w_frame styleMask:style backing:NSBackingStoreBuffered defer:NO];
[buildTargetPanel setDelegate:self];
[buildTargetPanel setReleasedWhenClosed:NO];
[buildTargetPanel setTitle:@"Build Options"];
_c_view = [buildTargetPanel contentView];
buildTargetPopup = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(72,24,184,20)];
[buildTargetPopup addItemWithTitle:@"Default"];
[buildTargetPopup addItemWithTitle:@"Debug"];
[buildTargetPopup addItemWithTitle:@"Profile"];
[buildTargetPopup addItemWithTitle:@"Install"];
[buildTargetPopup autorelease];
[buildTargetPopup setTarget:self];
[buildTargetPopup setAction:@selector(setTarget:)];
[_c_view addSubview:buildTargetPopup];
// Target (popup)
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(16,24,56,21)];
[textField setAlignment: NSRightTextAlignment];
[textField setBordered: NO];
[textField setEditable: NO];
[textField setBezeled: NO];
[textField setDrawsBackground: NO];
[textField setStringValue:@"Target:"];
[_c_view addSubview:[textField autorelease]];
// Host
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(16,48,56,21)];
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(16,24,56,21)];
[textField setAlignment: NSRightTextAlignment];
[textField setBordered: NO];
[textField setEditable: NO];
@ -262,17 +256,20 @@
[_c_view addSubview:[textField autorelease]];
// Host message
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(72,48,184,21)];
[textField setAlignment: NSLeftTextAlignment];
[textField setBordered: NO];
[textField setEditable: YES];
[textField setBezeled: YES];
[textField setDrawsBackground: YES];
[textField setStringValue:@"localhost"];
[_c_view addSubview:[textField autorelease]];
buildTargetHostField = [[NSTextField alloc] initWithFrame:NSMakeRect(72,24,184,21)];
[buildTargetHostField setAlignment: NSLeftTextAlignment];
[buildTargetHostField setBordered: NO];
[buildTargetHostField setEditable: YES];
[buildTargetHostField setBezeled: YES];
[buildTargetHostField setDrawsBackground: YES];
[buildTargetHostField setStringValue:@"localhost"];
[buildTargetHostField setDelegate:self];
[buildTargetHostField setTarget:self];
[buildTargetHostField setAction:@selector(setHost:)];
[_c_view addSubview:[buildTargetHostField autorelease]];
// Args
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(12,68,60,21)];
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(12,44,60,21)];
[textField setAlignment: NSRightTextAlignment];
[textField setBordered: NO];
[textField setEditable: NO];
@ -282,19 +279,20 @@
[_c_view addSubview:[textField autorelease]];
// Args message
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(72,68,184,21)];
[textField setAlignment: NSLeftTextAlignment];
[textField setBordered: NO];
[textField setEditable: YES];
[textField setBezeled: YES];
[textField setDrawsBackground: YES];
[textField setStringValue:@""];
[_c_view addSubview:[textField autorelease]];
buildTargetArgsField = [[NSTextField alloc] initWithFrame:NSMakeRect(72,44,184,21)];
[buildTargetArgsField setAlignment: NSLeftTextAlignment];
[buildTargetArgsField setBordered: NO];
[buildTargetArgsField setEditable: YES];
[buildTargetArgsField setBezeled: YES];
[buildTargetArgsField setDrawsBackground: YES];
[buildTargetArgsField setStringValue:@""];
[buildTargetArgsField setDelegate:self];
[buildTargetArgsField setTarget:self];
[buildTargetArgsField setAction:@selector(setArguments:)];
[_c_view addSubview:[buildTargetArgsField autorelease]];
// Redisplay!
[browser loadColumnZero];
_needsReleasing = YES;
}
@end
@ -308,18 +306,8 @@
- (id)init
{
if ((self = [super init])) {
_buildTarget = defaultTarget;
_needsReleasing = NO;
#if defined(GNUSTEP)
buildOptions = [[NSMutableDictionary alloc] init];
[self _initUI];
#else
if(![NSBundle loadNibNamed:@"Project.nib" owner:self]) {
[[NSException exceptionWithName:NIB_NOT_FOUND_EXCEPTION reason:@"Could not load Project.gmodel" userInfo:nil] raise];
return nil;
}
#endif
}
return self;
}
@ -351,11 +339,11 @@
[projectPath release];
[projectDict release];
if (_needsReleasing) {
[browserController release];
[projectWindow release];
[buildTargetPanel release];
}
[browserController release];
[projectWindow release];
[buildTargetPanel release];
[buildOptions release];
[super dealloc];
}
@ -369,6 +357,38 @@
return browserController;
}
- (NSString *)selectedRootCategory
{
return [self projectKeyForKeyPath:[browserController pathOfSelectedFile]];
}
- (NSArray *)fileExtensionsForCategory:(NSString *)key
{
if ([key isEqualToString:PCGModels]) {
return [NSArray arrayWithObjects:@"gmodel",@"gorm",nil];
}
else if ([key isEqualToString:PCClasses]) {
return [NSArray arrayWithObjects:@"m",nil];
}
else if ([key isEqualToString:PCHeaders]) {
return [NSArray arrayWithObjects:@"h",nil];
}
else if ([key isEqualToString:PCOtherSources]) {
return [NSArray arrayWithObjects:@"c",@"C",nil];
}
else if ([key isEqualToString:PCLibraries]) {
return [NSArray arrayWithObjects:@"so",@"a",@"lib",nil];
}
else if ([key isEqualToString:PCSubprojects]) {
return [NSArray arrayWithObjects:@"subproj",nil];
}
else if ([key isEqualToString:PCImages]) {
return [NSArray arrayWithObjects:@"tiff",@"TIFF",@"jpg",@"JPG",@"jpeg",@"JPEG",@"bmp",@"BMP",nil];
}
return nil;
}
- (void)setProjectName:(NSString *)aName
{
[projectName autorelease];
@ -408,13 +428,13 @@
- (void)setProjectBuilder:(id<ProjectBuilder>)aBuilder
{
[projectBuilder autorelease];
projectBuilder = [aBuilder retain];
[projectManager autorelease];
projectManager = [aBuilder retain];
}
- (id<ProjectBuilder>)projectBuilder
{
return projectBuilder;
return projectManager;
}
//===========================================================================================
@ -489,7 +509,7 @@
}
if ([files containsObject:newFile]) {
NSRunAlertPanel(@"Attention!",@"The file %@ is already contained in this project!",@"OK",nil,nil,newFile);
NSRunAlertPanel(@"Attention!",@"The file %@ is already part of this project!",@"OK",nil,nil,newFile);
return;
}
@ -522,6 +542,10 @@
NSString *file = [browserController nameOfSelectedFile];
NSMutableArray *array;
NSString *key;
NSString *otherKey;
NSString *ext;
NSString *fn;
BOOL ret = NO;
if (!file) {
return NO;
@ -530,11 +554,43 @@
key = [self projectKeyForKeyPath:[browserController pathOfSelectedFile]];
[self removeFile:file forKey:key];
if ([key isEqualToString:PCClasses]) {
otherKey = PCHeaders;
ext = [NSString stringWithString:@"h"];
fn = [file stringByDeletingPathExtension];
fn = [fn stringByAppendingPathExtension:ext];
if ([self doesAcceptFile:fn forKey:otherKey] == NO) {
ret = NSRunAlertPanel(@"Removing Header?",@"Should %@ be removed from the project %@ as well?",@"Yes",@"No",nil,fn,[self projectName]);
}
}
else if ([key isEqualToString:PCHeaders]) {
otherKey = PCClasses;
ext = [NSString stringWithString:@"m"];
fn = [file stringByDeletingPathExtension];
fn = [fn stringByAppendingPathExtension:ext];
if ([self doesAcceptFile:fn forKey:otherKey] == NO) {
ret = NSRunAlertPanel(@"Removing Class?",@"Should %@ be removed from the project %@ as well?",@"Yes",@"No",nil,fn,[self projectName]);
}
}
if (ret) {
[self removeFile:fn forKey:otherKey];
}
// Remove the file permanently?!
if (yn) {
NSString *pth = [projectPath stringByAppendingPathComponent:file];
[[NSFileManager defaultManager] removeFileAtPath:pth handler:nil];
if (ret) {
pth = [projectPath stringByAppendingPathComponent:fn];
[[NSFileManager defaultManager] removeFileAtPath:pth handler:nil];
}
}
return YES;
@ -641,7 +697,7 @@
- (void)showInspector:(id)sender
{
[projectBuilder showInspectorForProject:self];
[projectManager showInspectorForProject:self];
}
- (id)updatedAttributeView
@ -661,74 +717,34 @@
- (void)showBuildTargetPanel:(id)sender
{
[buildTargetPanel center];
if (![buildTargetPanel isVisible]) {
[buildTargetPanel center];
}
[buildTargetPanel makeKeyAndOrderFront:self];
}
- (void)setTarget:(id)sender
{
_buildTarget = [buildTargetPopup indexOfSelectedItem];
}
- (void)setHost:(id)sender
{
NSLog(@"Setting host...");
NSString *host = [buildTargetHostField stringValue];
[buildOptions setObject:host forKey:BUILD_HOST_KEY];
NSLog(@"New host %@",host);
}
- (void)setArguments:(id)sender
{
NSLog(@"Setting args...");
NSString *args = [buildTargetArgsField stringValue];
[buildOptions setObject:args forKey:BUILD_ARGS_KEY];
}
- (void)build:(id)sender
{
BOOL ret = YES;
NSString *target = [buildTargetPopup titleOfSelectedItem];
NSMutableDictionary *optionDict = [NSMutableDictionary dictionary];
[buildStatusField setStringValue:@"Building..."];
// Check the panel for this option!
if ([target isEqualToString:@"Debug"]) {
[optionDict setObject:TARGET_MAKE_DEBUG forKey:BUILD_KEY];
}
if ([target isEqualToString:@"Profile"]) {
[optionDict setObject:TARGET_MAKE_PROFILE forKey:BUILD_KEY];
}
if ([target isEqualToString:@"Install"]) {
[optionDict setObject:TARGET_MAKE_INSTALL forKey:BUILD_KEY];
}
else {
[optionDict setObject:TARGET_MAKE forKey:BUILD_KEY];
}
[[PCProjectBuilder sharedBuilder] buildProject:self options:optionDict];
if (ret) {
[buildStatusField setStringValue:@"Build completed!"];
}
else {
[buildStatusField setStringValue:@"Build failed!"];
}
[[PCProjectBuilder sharedBuilder] showPanelWithProject:self options:buildOptions];
}
- (void)clean:(id)sender
- (NSDictionary *)buildOptions
{
BOOL ret = YES;
NSMutableDictionary *optionDict = [NSMutableDictionary dictionary];
[buildStatusField setStringValue:@"Cleaning..."];
// Check the panel for this option!
[optionDict setObject:TARGET_MAKE_CLEAN forKey:BUILD_KEY];
[[PCProjectBuilder sharedBuilder] buildProject:self options:optionDict];
if (ret) {
[buildStatusField setStringValue:@"Cleaning completed!"];
}
else {
[buildStatusField setStringValue:@"Cleaning failed!"];
}
return (NSDictionary *)buildOptions;
}
@end
@ -758,7 +774,8 @@
}
key = [[keyPath componentsSeparatedByString:@"/"] lastObject];
if ([[rootCategories allKeys] containsObject:key] || [[projectDict objectForKey:PCSubprojects] containsObject:key]) {
if ([[rootCategories allKeys] containsObject:key] ||
[[projectDict objectForKey:PCSubprojects] containsObject:key]) {
return YES;
}
@ -767,9 +784,9 @@
- (NSString *)projectKeyForKeyPath:(NSString *)kp
{
NSString *type = [[kp componentsSeparatedByString:@"/"] objectAtIndex:1];
return [rootCategories objectForKey:type];
NSString *type = [[kp componentsSeparatedByString:@"/"] objectAtIndex:1];
return [rootCategories objectForKey:type];
}
@end
@ -778,23 +795,39 @@
- (void)windowDidBecomeKey:(NSNotification *)aNotification
{
[projectBuilder setActiveProject:self];
[projectManager setActiveProject:self];
}
- (void)windowDidBecomeMain:(NSNotification *)aNotification
{
[projectBuilder setActiveProject:self];
[projectManager setActiveProject:self];
}
- (void)windowWillClose:(NSNotification *)aNotification
{
id object = [aNotification object];
if (object == buildTargetPanel) {
}
else if (object == [self projectWindow]) {
if ([[self projectWindow] isDocumentEdited]) {
if (NSRunAlertPanel(@"Project changed!",@"The project %@ has unsaved files! Should they be saved before closing it?",@"Yes",@"No",nil,[self projectName])) {
[self save];
}
if (NSRunAlertPanel(@"Project changed!",@"The project %@ has unsaved files! Should they be saved before closing it?",@"Yes",@"No",nil,[self projectName])) {
[self save];
}
}
// The PCProjectController is our delegate!
[projectBuilder closeProject:self];
[projectManager closeProject:self];
}
}
@end
@implementation PCProject (TextDelegate)
- (void)textDidEndEditing:(NSNotification *)aNotification
{
}
@end

View file

@ -28,15 +28,6 @@
@class PCProject;
#define BUILD_KEY @"BuildKey"
#define BUILD_OPTIONS_KEY @"BuildOptionsKey"
#define TARGET_MAKE @"Make"
#define TARGET_MAKE_DEBUG @"MakeDebug"
#define TARGET_MAKE_PROFILE @"MakeProfile"
#define TARGET_MAKE_INSTALL @"MakeInstall"
#define TARGET_MAKE_CLEAN @"MakeClean"
@class NSWindow;
@class NSTextView;
@ -48,6 +39,9 @@
NSMutableDictionary *buildTasks;
NSString *makePath;
PCProject *currentProject;
NSDictionary *currentOptions;
}
+ (id)sharedBuilder;
@ -55,6 +49,16 @@
- (id)init;
- (void)dealloc;
- (BOOL)buildProject:(PCProject *)aProject options:(NSDictionary *)optionDict;
- (void)showPanelWithProject:(PCProject *)proj options:(NSDictionary *)options;
- (void)build:(id)sender;
- (void)clean:(id)sender;
- (void)install:(id)sender;
- (void)projectDidChange:(NSNotification *)aNotif;
@end

View file

@ -26,6 +26,7 @@
#import "PCProjectBuilder.h"
#import "PCProject.h"
#import "PCProjectManager.h"
#import <AppKit/AppKit.h>
@ -44,11 +45,12 @@
NSMiniaturizableWindowMask | NSResizableWindowMask;
NSSplitView *split;
NSScrollView *scrollView1;
NSScrollView *scrollView2;
NSTextView *textView2;
NSMatrix* matrix;
NSRect _w_frame;
NSButtonCell* buttonCell = [[[NSButtonCell alloc] init] autorelease];
id button;
/*
* Build Window
@ -69,7 +71,7 @@
[logOutput setVerticallyResizable:YES];
[logOutput setHorizontallyResizable:YES];
[logOutput setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
[logOutput setBackgroundColor:[NSColor whiteColor]];
//[logOutput setBackgroundColor:[NSColor whiteColor]];
[[logOutput textContainer] setWidthTracksTextView:YES];
scrollView1 = [[NSScrollView alloc] initWithFrame:NSMakeRect (0,0,496,92)];
@ -104,13 +106,60 @@
[scrollView2 setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
[scrollView2 autorelease];
split = [[[NSSplitView alloc] initWithFrame:NSMakeRect(8,0,496,264)] autorelease];
split = [[[NSSplitView alloc] initWithFrame:NSMakeRect(8,0,496,288)] autorelease];
[split setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
[split addSubview: scrollView1];
[split addSubview: scrollView2];
_c_view = [buildWindow contentView];
[_c_view addSubview:split];
/*
* 5 build Buttons
*/
_w_frame = NSMakeRect(8,292,244,24);
matrix = [[[NSMatrix alloc] initWithFrame: _w_frame
mode: NSHighlightModeMatrix
prototype: buttonCell
numberOfRows: 1
numberOfColumns: 5] autorelease];
[matrix setIntercellSpacing:NSMakeSize(1,1)];
[matrix setSelectionByRect:YES];
[matrix setAutoresizingMask: (NSViewMaxXMargin | NSViewMinYMargin)];
[matrix setTarget:self];
[matrix setAction:@selector(build:)];
[_c_view addSubview:matrix];
button = [matrix cellAtRow:0 column:0];
[button setTag:0];
[button setImagePosition:NSNoImage];
[button setButtonType:NSMomentaryPushButton];
[button setTitle:@"Build"];
button = [matrix cellAtRow:0 column:1];
[button setTag:1];
[button setImagePosition:NSNoImage];
[button setButtonType:NSMomentaryPushButton];
[button setTitle:@"Clean"];
button = [matrix cellAtRow:0 column:2];
[button setTag:2];
[button setImagePosition:NSNoImage];
[button setButtonType:NSMomentaryPushButton];
[button setTitle:@"Debug"];
button = [matrix cellAtRow:0 column:3];
[button setTag:3];
[button setImagePosition:NSNoImage];
[button setButtonType:NSMomentaryPushButton];
[button setTitle:@"Profile"];
button = [matrix cellAtRow:0 column:4];
[button setTag:4];
[button setImagePosition:NSNoImage];
[button setButtonType:NSMomentaryPushButton];
[button setTitle:@"Install"];
}
@end
@ -133,12 +182,16 @@ static PCProjectBuilder *_builder;
[self _initUI];
makePath = [[NSString stringWithString:@"/usr/bin/make"] retain];
buildTasks = [[NSMutableDictionary dictionary] retain];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(projectDidChange:) name:ActiveProjectDidChangeNotification object:nil];
}
return self;
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[buildWindow release];
[makePath release];
[buildTasks release];
@ -146,9 +199,21 @@ static PCProjectBuilder *_builder;
[super dealloc];
}
- (BOOL)buildProject:(PCProject *)aProject options:(NSDictionary *)optionDict
- (void)showPanelWithProject:(PCProject *)proj options:(NSDictionary *)options;
{
if (![buildWindow isVisible]) {
[buildWindow center];
}
[buildWindow makeKeyAndOrderFront:self];
currentProject = proj;
currentOptions = options;
[buildWindow setTitle:[proj projectName]];
}
- (void)build:(id)sender
{
BOOL ret = NO;
NSString *tg = nil;
NSTask *makeTask;
NSMutableArray *args;
@ -156,73 +221,82 @@ static PCProjectBuilder *_builder;
NSPipe *logPipe;
NSFileHandle *readHandle;
NSData *inData = nil;
NSDictionary *optionDict;
if (!currentProject) {
return;
}
logPipe = [NSPipe pipe];
readHandle = [logPipe fileHandleForReading];
NSAssert(aProject,@"No project provided!");
makeTask = [[NSTask alloc] init];
if ((tg = [optionDict objectForKey:BUILD_KEY])) {
if ([tg isEqualToString:TARGET_MAKE_DEBUG]) {
args = [NSMutableArray array];
[args addObject:@"debug=yes"];
[makeTask setArguments:args];
}
else if ([tg isEqualToString:TARGET_MAKE_PROFILE]) {
args = [NSMutableArray array];
[args addObject:@"profile=YES"];
[args addObject:@"static=YES"];
[makeTask setArguments:args];
}
else if ([tg isEqualToString:TARGET_MAKE_INSTALL]) {
args = [NSMutableArray array];
[args addObject:@"install"];
[makeTask setArguments:args];
}
else if ([tg isEqualToString:TARGET_MAKE_CLEAN]) {
args = [NSMutableArray array];
[args addObject:@"clean"];
[makeTask setArguments:args];
}
optionDict = [currentProject buildOptions];
args = [NSMutableArray array];
[makeTask setCurrentDirectoryPath:[aProject projectPath]];
[makeTask setLaunchPath:makePath];
switch ([[sender selectedCell] tag]) {
case 0:
break;
case 1:
[args addObject:@"clean"];
break;
case 2:
[args addObject:@"debug=yes"];
break;
case 3:
[args addObject:@"profile=yes"];
[args addObject:@"static=yes"];
break;
case 4:
[args addObject:@"install"];
break;
}
[makeTask setStandardOutput:logPipe];
[makeTask setStandardError:logPipe];
[makeTask setArguments:args];
if (![buildWindow isVisible]) {
[buildWindow center];
[buildWindow makeKeyAndOrderFront:self];
}
[makeTask launch];
/*
* This is just a quick hack for now...
*/
while ((inData = [readHandle availableData]) && [inData length]) {
output = [[NSString alloc] initWithData:inData encoding:NSASCIIStringEncoding];
[logOutput setString:[NSString stringWithFormat:@"%@%@\n", [logOutput string], output]];
[logOutput scrollRangeToVisible:NSMakeRange([[logOutput textStorage] length], 0)];
[output release];
}
[makeTask waitUntilExit];
ret = [makeTask terminationStatus];
#ifdef DEBUG
NSLog(@"Task terminated %@...",(ret)?@"successfully":@"not successfully");
#endif DEBUG
[makeTask autorelease];
[makeTask setCurrentDirectoryPath:[currentProject projectPath]];
[makeTask setLaunchPath:makePath];
[makeTask setStandardOutput:logPipe];
[makeTask setStandardError:logPipe];
[makeTask launch];
/*
* This is just a quick hack for now...
*/
while ((inData = [readHandle availableData]) && [inData length]) {
output = [[NSString alloc] initWithData:inData encoding:NSASCIIStringEncoding];
[logOutput setString:[NSString stringWithFormat:@"%@%@\n", [logOutput string], output]];
[logOutput scrollRangeToVisible:NSMakeRange([[logOutput textStorage] length], 0)];
[output release];
}
return ret;
[makeTask waitUntilExit];
[makeTask autorelease];
}
- (void)clean:(id)sender
{
}
- (void)install:(id)sender
{
}
- (void)projectDidChange:(NSNotification *)aNotif
{
PCProject *project = [aNotif object];
if (project) {
currentProject = project;
[buildWindow setTitle:[project projectName]];
}
else {
currentProject = nil;
[buildWindow orderOut:self];
}
}
@end

View file

@ -167,3 +167,7 @@
- (BOOL)projectManager:(id)sender shouldOpenProject:(PCProject *)aProject;
@end
extern NSString *ActiveProjectDidChangeNotification;

View file

@ -31,6 +31,8 @@
#import <AppKit/IMLoading.h>
#endif
NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
@interface PCProjectManager (CreateUI)
- (void)_initUI;
@ -155,18 +157,20 @@
- (void)setActiveProject:(PCProject *)aProject
{
if (aProject != activeProject) {
activeProject = aProject;
if (aProject != activeProject) {
activeProject = aProject;
//~ Is this needed?
if (activeProject) {
[[activeProject projectWindow] makeKeyAndOrderFront:self];
}
if ([inspector isVisible]) {
[self inspectorPopupDidChange:inspectorPopup];
}
[[NSNotificationCenter defaultCenter] postNotificationName:ActiveProjectDidChangeNotification object:activeProject];
//~ Is this needed?
if (activeProject) {
[[activeProject projectWindow] makeKeyAndOrderFront:self];
}
if ([inspector isVisible]) {
[self inspectorPopupDidChange:inspectorPopup];
}
}
}
- (void)saveAllProjects
@ -198,6 +202,8 @@
concretBuilder = [NSClassFromString([builders objectForKey:builderKey]) sharedCreator];
if ((project = [concretBuilder openProjectAt:aPath])) {
[[project projectWindow] center];
return project;
}
}
@ -250,6 +256,8 @@
return NO;
}
[[project projectWindow] center];
[project setProjectBuilder:self];
[loadedProjects setObject:project forKey:aPath];
[self setActiveProject:project];
@ -271,38 +279,31 @@
- (void)inspectorPopupDidChange:(id)sender
{
NSView *view = nil;
if (![self activeProject]) {
return;
}
switch([sender indexOfSelectedItem]) {
case 0:
view = [[[self activeProject] updatedAttributeView] retain];
break;
case 1:
view = [[[self activeProject] updatedProjectView] retain];
break;
case 2:
view = [[[self activeProject] updatedFilesView] retain];
break;
}
[(NSBox *)inspectorView setContentView:view];
[inspectorView display];
NSView *view = nil;
if (![self activeProject]) {
return;
}
switch([sender indexOfSelectedItem]) {
case 0:
view = [[[self activeProject] updatedAttributeView] retain];
break;
case 1:
view = [[[self activeProject] updatedProjectView] retain];
break;
case 2:
view = [[[self activeProject] updatedFilesView] retain];
break;
}
[(NSBox *)inspectorView setContentView:view];
[inspectorView display];
}
- (void)showInspectorForProject:(PCProject *)aProject
{
if (!inspectorPopup) {
#if defined(GNUSTEP)
[self _initUI];
#else
if(![NSBundle loadNibNamed:@"Inspector.nib" owner:self]) {
[[NSException exceptionWithName:NIB_NOT_FOUND_EXCEPTION reason:@"Could not load Inspector.gmodel" userInfo:nil] raise];
return nil;
}
#endif
[inspectorPopup removeAllItems];
[inspectorPopup addItemWithTitle:@"Build Attributes"];
@ -460,3 +461,5 @@
@end

View file

@ -42,7 +42,7 @@ extern NSString *PCProjectDidUpdateNotification;
extern NSString *PCFileAddedToProjectNotification;
extern NSString *PCFileRemovedFromProjectNotification;
extern NSString *PCFileWillOpenNotification;
extern NSString *PCFileDidOpenNotification;
extern NSString *PCFileDidOpenNotification;
extern NSString *PCFileWillCloseNotification;
extern NSString *PCFileDidCloseNotification;
@ -64,11 +64,28 @@ extern NSString *PCProjectBuildDidStopNotification;
@interface PCServer : NSObject <Server>
{
NSMutableArray *clients;
NSMutableArray *openDocuments;
}
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init;
- (void)dealloc;
//----------------------------------------------------------------------------
// Miscellaneous
//----------------------------------------------------------------------------
- (void)fileShouldBeOpened:(NSNotification *)aNotif;
- (void)openFileInExternalEditor:(NSString *)file;
- (void)openFileInInternalEditor:(NSString *)file;
- (NSWindow *)editorForFile:(NSString *)aFile;
- (void)windowDidClose:(NSNotification *)aNotif;
//----------------------------------------------------------------------------
// Server
//----------------------------------------------------------------------------
@ -90,7 +107,7 @@ extern NSString *PCProjectBuildDidStopNotification;
- (NSArray*)touchedFiles;
// Both methods return full paths!
- (BOOL)querTouchedFiles;
- (BOOL)queryTouchedFiles;
// Prompts user to save all files and projects with dirtied buffers.
- (BOOL)addFileAt:(NSString*)filePath toProject:(PCProject *)projectPath;

View file

@ -26,23 +26,135 @@
#import "PCServer.h"
#import "ProjectCenter.h"
#import "PCBrowserController.h"
@implementation PCServer
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init
{
if ((self = [super init])) {
clients = [[NSMutableArray alloc] init];
}
return self;
if ((self = [super init])) {
clients = [[NSMutableArray alloc] init];
openDocuments = [[NSMutableArray alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fileShouldBeOpened:) name:FileShouldOpenNotification object:nil];
}
return self;
}
- (void)dealloc
{
[clients release];
[super dealloc];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[openDocuments release];
[clients release];
[super dealloc];
}
//----------------------------------------------------------------------------
// Miscellaneous
//----------------------------------------------------------------------------
- (void)fileShouldBeOpened:(NSNotification *)aNotif
{
NSString *file = [[aNotif userInfo] objectForKey:@"FilePathKey"];
if ([[[NSUserDefaults standardUserDefaults] objectForKey:ExternalEditor] isEqualToString:@"YES"]) {
[self openFileInExternalEditor:file];
}
else {
[self openFileInInternalEditor:file];
}
}
- (void)openFileInExternalEditor:(NSString *)file
{
NSTask *editorTask;
NSMutableArray *args = [NSMutableArray array];
NSUserDefaults *udef = [NSUserDefaults standardUserDefaults];
NSString *editor = [udef objectForKey:Editor];
editorTask = [[[NSTask alloc] init] autorelease];
[editorTask setLaunchPath:editor];
[args addObject:file];
[editorTask setArguments:args];
[editorTask launch];
}
- (void)openFileInInternalEditor:(NSString *)file
{
NSWindow *editorWindow = [self editorForFile:file];
[editorWindow setDelegate:self];
[editorWindow center];
[editorWindow makeKeyAndOrderFront:self];
[openDocuments addObject:editorWindow];
}
- (NSWindow *)editorForFile:(NSString *)aFile
{
unsigned int style = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask;
NSRect rect = NSMakeRect(100,100,512,320);
NSWindow *window = [[NSWindow alloc] initWithContentRect:rect
styleMask:style
backing:NSBackingStoreBuffered
defer:NO];
NSTextView *textView;
NSScrollView *scrollView;
NSString *text = [NSString stringWithContentsOfFile:aFile];
[window setMinSize:NSMakeSize(512,320)];
[window setTitle:[aFile lastPathComponent]];
textView = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,498,306)];
[textView setMaxSize:NSMakeSize(1e7, 1e7)];
[textView setVerticallyResizable:YES];
[textView setHorizontallyResizable:YES];
[textView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
[textView setBackgroundColor:[NSColor whiteColor]];
[[textView textContainer] setWidthTracksTextView:YES];
[textView autorelease];
scrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect (-1,-1,514,322)];
[scrollView setDocumentView:textView];
[textView setMinSize:NSMakeSize(0.0,[scrollView contentSize].height)];
[[textView textContainer] setContainerSize:NSMakeSize([scrollView contentSize].width,1e7)];
[scrollView setHasHorizontalScroller: YES];
[scrollView setHasVerticalScroller: YES];
[scrollView setBorderType: NSBezelBorder];
[scrollView setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
[scrollView autorelease];
[[window contentView] addSubview:scrollView];
/*
* Will be replaced when a real editor is available...
*/
[textView setText:text];
return [window autorelease];
}
- (void)windowDidClose:(NSNotification *)aNotif
{
NSWindow *window = [aNotif object];
[openDocuments removeObject:window];
}
//----------------------------------------------------------------------------
// Server
//----------------------------------------------------------------------------
- (BOOL)registerProjectSubmenu:(NSMenu *)menu
{
}
@ -91,7 +203,7 @@
{
}
- (BOOL)querTouchedFiles
- (BOOL)queryTouchedFiles
{
}

View file

@ -42,6 +42,7 @@
#define BundlePaths @"BundlePaths"
#define SuccessSound @"SuccessSound"
#define FailureSound @"FailureSound"
#define ExternalEditor @"ExternalEditor"
#define PCAppDidInitNotification @"PCAppDidInit"
#define PCAppWillTerminateNotification @"PCAppWillTerminate"

View file

@ -50,7 +50,7 @@
- (NSArray*)touchedFiles;
// Returns array of paths of files that are "unsaved" or nil if none.
- (BOOL)querTouchedFiles;
- (BOOL)queryTouchedFiles;
// Prompts user to save all files and projects with dirtied buffers.
- (BOOL)addFileAt:(NSString*)filePath toProject:(PCProject *)projectPath;

View file

@ -83,13 +83,17 @@ static PCLibMakefileFactory *_factory = nil;
[string appendString:[NSString stringWithFormat:@"LIBRARY_NAME=%@\n",libName]];
// Install path
[string appendString:[NSString stringWithFormat:@"%@_INSTALL_PREFIX=$(GNUSTEP_SYSTEM_ROOT)\n",[prName uppercaseString]]];
[string appendString:[NSString stringWithFormat:@"%@_HEADER_FILES_DIR=.\n",libName]];
[string appendString:[NSString stringWithFormat:@"%@_HEADER_FILES_INSTALL_DIR=/%@\n",libName,prName]];
[string appendString:[NSString stringWithFormat:@"%@_INSTALL_PREFIX=$(GNUSTEP_LOCAL_ROOT)\n",[prName uppercaseString]]];
[string appendString:@"ADDITIONAL_INCLUDE_DIRS = -I..\n"];
[string appendString:@"srcdir = .\n"];
[string appendString:@"#\n\n"];
[string appendString:@"# Additional libraries\n"];
[string appendString:@"#\n\n"];
[string appendString:[NSString stringWithFormat:@"%@_ADDITIONAL_TOOL_LIBS += ",prName]];
[string appendString:[NSString stringWithFormat:@"%@_LIBRARIES_DEPEND_UPON += ",prName]];
if ([[prDict objectForKey:PCLibraries] count]) {
enumerator = [[prDict objectForKey:PCLibraries] objectEnumerator];
@ -135,8 +139,6 @@ static PCLibMakefileFactory *_factory = nil;
[string appendString:@"\n\n"];
[string appendString:[NSString stringWithFormat:@"%@_HEADER_FILES_INSTALL_DIR=/%@\n",libName,prName]];
[string appendString:@"-include GNUmakefile.preamble\n"];
[string appendString:@"-include GNUmakefile.local\n"];
[string appendString:@"include $(GNUSTEP_MAKEFILES)/library.make\n"];

View file

@ -52,7 +52,7 @@ ADDITIONAL_CFLAGS +=
ADDITIONAL_INCLUDE_DIRS +=
# Additional LDFLAGS to pass to the linker
ADDITIONAL_LDFLAGS += -lPC
ADDITIONAL_LDFLAGS += -lProjectCenter
# Additional library directories the linker should search
ADDITIONAL_LIB_DIRS +=

File diff suppressed because it is too large Load diff

View file

@ -19,12 +19,10 @@ include $(GNUSTEP_MAKEFILES)/common.make
APP_NAME=ProjectCenter
ProjectCenter_LDFLAGS = -lPC
ProjectCenter_MAIN_MODEL_FILE = ProjectCenter.gmodel
ProjectCenter_LDFLAGS = -lProjectCenter
ProjectCenter_APPLICATION_ICON = ProjectCenter.tiff
ProjectCenter_RESOURCE_FILES= \
English.lproj/ProjectCenter.gmodel \
ProjectCenter.tiff \
ProjectCenter.app.tiff \
ProjectCentre_add.tiff \
@ -37,6 +35,7 @@ ProjectCenter_RESOURCE_FILES= \
ProjectCentre_prefs.tiff \
ProjectCentre_run.tiff \
ProjectCentre_uml.tiff \
ProjectCentre_settings.tiff \
FileIcon_.c.tiff \
FileIcon_.h.tiff \
FileIcon_.m.tiff \
@ -48,6 +47,7 @@ ProjectCenter_RESOURCE_FILES= \
ProjectCenter_HEADERS= \
PCAppController.h \
PCAppController+MenuHandling.h \
PCFindController.h \
PCInfoController.h \
PCLogController.h \
@ -60,6 +60,7 @@ ProjectCenter_HEADERS= \
ProjectCenter_OBJC_FILES= \
PCAppController.m \
PCAppController+MenuHandling.m \
PCFindController.m \
PCInfoController.m \
PCLogController.m \

View file

@ -52,7 +52,7 @@ ADDITIONAL_CFLAGS +=
ADDITIONAL_INCLUDE_DIRS +=
# Additional LDFLAGS to pass to the linker
ADDITIONAL_LDFLAGS += -lPC
ADDITIONAL_LDFLAGS += -lProjectCenter
# Additional library directories the linker should search
ADDITIONAL_LIB_DIRS +=

View file

@ -4,7 +4,7 @@
ApplicationDescription = "GNUstep IDE";
ApplicationIcon = "ProjectCenter.tiff";
ApplicationRelease = "ProjectCenter 0.1";
FullVersionID = "0.1 pre pre pre pre epsilon";
FullVersionID = "0.1";
Authors = ("Philippe C.D. Robert <phr@projectcenter.ch>");
URL = "http://www.projectcenter.ch";
Copyright = "Copyright (C) 2000 Philippe C.D. Robert";

View file

@ -9,6 +9,7 @@
"PCInfoController.m",
"PCLogController.m",
"PCMenuController.m",
"PCPrefController.m",
"ProjectCenter_main.m"
);
COMPILEROPTIONS = "";
@ -27,23 +28,17 @@
"PCPrefController.h"
);
IMAGES = (
"build.tiff"
);
INSTALLDIR = "$(HOME)/Apps";
INTERFACES = (
"main.gmodel",
"FileCreation.gmodel",
"Info.gmodel",
"Preferences.gmodel",
"Project.gmodel",
"ProjectCenter.gmodel",
"PCPrefController.m"
"ProjectCenter.gmodel"
);
LANGUAGE = English;
"LAST_EDITING" = "";
LIBRARIES = (
"gnustep-base",
"gnustep-gui"
"gnustep-gui",
ProjectCenter
);
MAININTERFACE = "main.gmodel";
MAKEFILEDIR = "/usr/GNUstep/Makefiles";
@ -58,7 +53,7 @@
"PROJECT_CREATOR" = "";
"PROJECT_DESCRIPTION" = "No description avaliable!";
"PROJECT_MAINTAINER" = "";
"PROJECT_NAME" = PC;
"PROJECT_NAME" = ProjectCenter;
"PROJECT_TYPE" = PCAppProject;
"PROJECT_VERSION" = "1.0";
SUBPROJECTS = (

View file

@ -0,0 +1,64 @@
/*
GNUstep ProjectCenter - http://www.projectcenter.ch
Copyright (C) 2000 Philippe C.D. Robert
Author: Philippe C.D. Robert <phr@projectcenter.ch>
This file is part of ProjectCenter.
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This application is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$Id$
*/
#import <AppKit/AppKit.h>
#import "PCAppController.h"
@interface PCAppController (MenuHandling)
- (void)showPrefWindow:(id)sender;
- (void)showInfoPanel:(id)sender;
- (void)showInspector:(id)sender;
- (void)showBuildPanel:(id)sender;
- (void)openProject:(id)sender;
- (void)newProject:(id)sender;
- (void)saveProject:(id)sender;
- (void)saveProjectAs:(id)sender;
- (void)showLoadedProjects:(id)sender;
- (void)saveFiles:(id)sender;
- (void)revertToSaved:(id)sender;
- (void)newSubproject:(id)sender;
- (void)addSubproject:(id)sender;
- (void)removeSubproject:(id)sender;
- (void)closeProject:(id)sender;
- (void)newFile:(id)sender;
- (void)addFile:(id)sender;
- (void)openFile:(id)sender;
- (void)saveFile:(id)sender;
- (void)saveFileAs:(id)sender;
- (void)revertFile:(id)sender;
- (void)renameFile:(id)sender;
- (void)removeFile:(id)sender;
@end

View file

@ -0,0 +1,150 @@
/*
GNUstep ProjectCenter - http://www.projectcenter.ch
Copyright (C) 2000 Philippe C.D. Robert
Author: Philippe C.D. Robert <phr@projectcenter.ch>
This file is part of ProjectCenter.
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This application is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$Id$
*/
#import "PCAppController+MenuHandling.h"
#import "PCMenuController.h"
#import "PCPrefController.h"
#import "PCInfoController.h"
#import <ProjectCenter/PCProjectManager.h>
@implementation PCAppController (MenuHandling)
- (void)showPrefWindow:(id)sender
{
[prefController showPrefWindow:sender];
}
- (void)showInfoPanel:(id)sender
{
[infoController showInfoWindow:sender];
}
- (void)showInspector:(id)sender
{
[projectManager showInspectorForProject:[projectManager activeProject]];
}
- (void)showBuildPanel:(id)sender;
{
[[projectManager activeProject] build:self];
}
- (void)openProject:(id)sender
{
[menuController openProject:sender];
}
- (void)newProject:(id)sender
{
[menuController newProject:sender];
}
- (void)saveProject:(id)sender
{
[menuController saveProject:sender];
}
- (void)saveProjectAs:(id)sender
{
[menuController saveProjectAs:sender];
}
- (void)showLoadedProjects:(id)sender
{
[menuController showLoadedProjects:sender];
}
- (void)saveFiles:(id)sender
{
[menuController saveFiles:sender];
}
- (void)revertToSaved:(id)sender
{
[menuController revertToSaved:sender];
}
- (void)newSubproject:(id)sender
{
[menuController newSubproject:sender];
}
- (void)addSubproject:(id)sender
{
[menuController addSubproject:sender];
}
- (void)removeSubproject:(id)sender
{
[menuController removeSubproject:sender];
}
- (void)closeProject:(id)sender
{
[menuController closeProject:sender];
}
- (void)newFile:(id)sender
{
[menuController newFile:sender];
}
- (void)addFile:(id)sender
{
[menuController addFile:sender];
}
- (void)openFile:(id)sender
{
[menuController openFile:sender];
}
- (void)saveFile:(id)sender
{
[menuController saveFile:sender];
}
- (void)saveFileAs:(id)sender
{
[menuController saveFileAs:sender];
}
- (void)revertFile:(id)sender
{
[menuController revertFile:sender];
}
- (void)renameFile:(id)sender
{
[menuController renameFile:sender];
}
- (void)removeFile:(id)sender
{
[menuController removeFile:sender];
}
@end

View file

@ -39,21 +39,21 @@
@interface PCAppController : NSObject
{
IBOutlet PCPrefController *prefController;
IBOutlet PCFindController *finder;
IBOutlet PCInfoController *infoController;
IBOutlet PCLogController *logger;
IBOutlet PCProjectManager *projectManager;
IBOutlet PCFileManager *fileManager;
IBOutlet PCMenuController *menuController;
PCBundleLoader *bundleLoader;
PCServer *doServer;
NSConnection *doConnection;
id delegate;
NSMutableDictionary *projectTypes;
PCPrefController *prefController;
PCFindController *finder;
PCInfoController *infoController;
PCLogController *logger;
PCProjectManager *projectManager;
PCFileManager *fileManager;
PCMenuController *menuController;
PCBundleLoader *bundleLoader;
PCServer *doServer;
NSConnection *doConnection;
id delegate;
NSMutableDictionary *projectTypes;
}
//============================================================================
@ -108,4 +108,4 @@
- (BOOL)registerProjectCreator:(NSString *)className forKey:(NSString *)aKey;
// Returns YES upon successfully registering a new projecttype.
@end
@end

View file

@ -38,12 +38,7 @@
+ (void)initialize
{
NSMutableDictionary *defaults = [NSMutableDictionary dictionary];
#if defined(GNUSTEP)
NSString *_bundlePath = @"/usr/GNUstep/Local/Library/ProjectCenter";
#else
NSString *_bundlePath = @"/LocalLibrary/ProjectCenter";
#endif
[defaults setObject:_bundlePath forKey:BundlePaths];
@ -51,6 +46,8 @@
[defaults setObject:@"/usr/bin/gdb" forKey:Debugger];
[defaults setObject:@"/usr/bin/gcc" forKey:Compiler];
[defaults setObject:@"YES" forKey:ExternalEditor];
[defaults setObject:[NSString stringWithFormat:@"%@/ProjectCenterBuildDir",NSTemporaryDirectory()] forKey:RootBuildDirectory];
/*
@ -75,6 +72,21 @@
// They are registered by the bundleLoader
projectTypes = [[NSMutableDictionary alloc] init];
prefController = [[PCPrefController alloc] init];
finder = [[PCFindController alloc] init];
infoController = [[PCInfoController alloc] init];
logger = [[PCLogController alloc] init];
projectManager = [[PCProjectManager alloc] init];
fileManager = [PCFileManager fileManager];
menuController = [[PCMenuController alloc] init];
[projectManager setDelegate:self];
[fileManager setDelegate:projectManager];
[menuController setAppController:self];
[menuController setFileManager:fileManager];
[menuController setProjectManager:projectManager];
}
return self;
}
@ -86,7 +98,14 @@
[doConnection release];
}
[prefController release];
[finder release];
[infoController release];
[logger release];
[projectManager release];
[fileManager release];
[menuController release];
[bundleLoader release];
[doServer release];
[projectTypes release];
@ -153,35 +172,30 @@
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
[logger logMessage:@"Loading additional subsystems..." tag:INFORMATION];
NSString *h = [[NSProcessInfo processInfo] hostName];
NSString *connectionName = [NSString stringWithFormat:@"ProjectCenter:%@",h];
[logger logMessage:@"Loading additional subsystems..." tag:INFORMATION];
[bundleLoader loadBundles];
// The DO server
doServer = [[PCServer alloc] init];
NS_DURING
doConnection = [[NSConnection alloc] init];
[doConnection registerName:connectionName];
NS_HANDLER
NSRunAlertPanel(@"Warning!",@"Could not register the DO connection %@",@"OK",nil,nil,nil,connectionName);
NS_ENDHANDLER
[[NSNotificationCenter defaultCenter] addObserver:doServer selector:@selector(connectionDidDie:) name:NSConnectionDidDieNotification object:doConnection];
[doConnection setDelegate:doServer];
[bundleLoader loadBundles];
// The DO server
doServer = [[PCServer alloc] init];
#if defined(GNUSTEP)
NS_DURING
doConnection = [NSConnection newRegisteringAtName:@"ProjectCenter" withRootObject:doServer];
[logger logMessage:@"Successful initialisation of the DO connection 'ProjectCenter'." tag:INFORMATION];
NS_HANDLER
[logger logMessage:@"Could not initialise the DO connection 'ProjectCenter'!" tag:WARNING];
NSRunAlertPanel(@"Warning!",@"Could not register the DO connection 'ProjectCenter'",@"OK",nil,nil,nil);
NS_ENDHANDLER
#else
doConnection = [NSConnection defaultConnection];
[doConnection setRootObject:doServer];
if (![doConnection registerName:@"ProjectCenter"]) {
[logger logMessage:@"Could not initialise the DO connection 'ProjectCenter'!" tag:WARNING];
}
else {
[logger logMessage:@"Successful initialisation of the DO connection 'ProjectCenter'." tag:INFORMATION];
}
#endif
[[NSNotificationCenter defaultCenter] addObserver:doServer selector:@selector(connectionDidDie:) name:NSConnectionDidDieNotification object:doConnection];
[doConnection setDelegate:doServer];
[[NSNotificationCenter defaultCenter] postNotificationName:PCAppDidInitNotification object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:PCAppDidInitNotification object:nil];
}
- (BOOL)applicationShouldTerminate:(id)sender

View file

@ -32,17 +32,25 @@
@interface PCMenuController : NSObject
{
IBOutlet PCProjectManager *projectManager;
IBOutlet PCFileManager *fileManager;
IBOutlet PCAppController *appController;
NSBox *projectTypeAccessaryView;
id projectTypePopup;
PCProjectManager *projectManager;
PCFileManager *fileManager;
PCAppController *appController;
NSBox *projectTypeAccessaryView;
id projectTypePopup;
}
//============================================================================
//==== Init and free
//============================================================================
- (id)init;
- (void)dealloc;
- (void)setAppController:(id)anObject;
- (void)setFileManager:(id)anObject;
- (void)setProjectManager:(id)anObject;
//============================================================================
//==== Menu stuff
//============================================================================

View file

@ -71,6 +71,24 @@
[projectTypePopup addItemWithTitle:name];
}
- (void)setAppController:(id)anObject
{
[appController autorelease];
appController = [anObject retain];
}
- (void)setFileManager:(id)anObject
{
[fileManager autorelease];
fileManager = [anObject retain];
}
- (void)setProjectManager:(id)anObject
{
[projectManager autorelease];
projectManager = [anObject retain];
}
//============================================================================
//==== Menu stuff
//============================================================================
@ -184,21 +202,21 @@
- (void)openFile:(id)sender
{
NSString *filePath;
NSOpenPanel *openPanel;
int retval;
openPanel = [NSOpenPanel openPanel];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setCanChooseDirectories:NO];
[openPanel setCanChooseFiles:YES];
retval = [openPanel runModalForDirectory:[[NSUserDefaults standardUserDefaults] objectForKey:@"LastOpenDirectory"] file:nil types:nil];
NSOpenPanel *openPanel;
int retval;
openPanel = [NSOpenPanel openPanel];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setCanChooseDirectories:NO];
[openPanel setCanChooseFiles:YES];
retval = [openPanel runModalForDirectory:[[NSUserDefaults standardUserDefaults] objectForKey:@"LastOpenDirectory"] file:nil types:nil];
if (retval == NSOKButton) {
BOOL isDir;
[[NSUserDefaults standardUserDefaults] setObject:[openPanel directory] forKey:@"LastOpenDirectory"];
filePath = [[openPanel filenames] objectAtIndex:0];
[[NSUserDefaults standardUserDefaults] setObject:[openPanel directory] forKey:@"LastOpenDirectory"];
filePath = [[openPanel filenames] objectAtIndex:0];
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath isDirectory:&isDir] && !isDir) {
if (![projectManager openFile:filePath]) {
@ -243,20 +261,20 @@
- (void)removeFile:(id)sender
{
NSString *file = nil;
PCProject *proj = [projectManager activeProject];
if ((file = [[proj browserController] nameOfSelectedFile])) {
int ret;
ret = NSRunAlertPanel(@"Remove File!",@"Really remove %@ in project %@?",@"Cancel",@"...from Project only",@"...from Project and Disk",file,[proj projectName]);
if (ret == NSAlertAlternateReturn || ret == NSAlertOtherReturn) {
BOOL flag = (ret == NSAlertOtherReturn) ? YES : NO;
[projectManager removeFilePermanently:flag];
}
}
NSString *file = nil;
PCProject *proj = [projectManager activeProject];
if ((file = [[proj browserController] nameOfSelectedFile])) {
int ret;
ret = NSRunAlertPanel(@"Remove File!",@"Really remove %@ in project %@?",@"Cancel",@"...from Project only",@"...from Project and Disk",file,[proj projectName]);
if (ret == NSAlertAlternateReturn || ret == NSAlertOtherReturn) {
BOOL flag = (ret == NSAlertOtherReturn) ? YES : NO;
[projectManager removeFilePermanently:flag];
}
}
}
//============================================================================

View file

@ -40,6 +40,8 @@
id failureField;
id autoSaveField;;
id useExternalEditor;
id editorField;
id debuggerField;
@ -47,9 +49,6 @@
id bundlePathField;
NSMutableDictionary *preferencesDict;
@private
BOOL _needsReleasing;
}
- (id)init;
@ -66,6 +65,8 @@
- (void)setRemoveBackup:(id)sender;
- (void)setSavePeriod:(id)sender;
- (void)setUseExternalEditor:(id)sender;
- (void)setEditor:(id)sender;
- (void)setCompiler:(id)sender;
- (void)setDebugger:(id)sender;

View file

@ -48,6 +48,7 @@
NSBox *line;
NSBox *v;
NSButton *b;
NSTextField *textField;
/*
* Pref Window
@ -116,15 +117,93 @@
[prefMiscView setBorderType:NSNoBorder];
v = [[[NSBox alloc] init] autorelease];
[v setTitle:@"External"];
[v setTitle:@"External Editor"];
[v setFrameFromContentFrame:NSMakeRect(16,184,228,96)];
[prefMiscView addSubview:v];
/*
* Editor
*/
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(12,24,60,21)];
[textField setAlignment: NSRightTextAlignment];
[textField setBordered: NO];
[textField setEditable: NO];
[textField setBezeled: NO];
[textField setDrawsBackground: NO];
[textField setStringValue:@"Editor:"];
[v addSubview:[textField autorelease]];
editorField = [[NSTextField alloc] initWithFrame:NSMakeRect(72,24,184,21)];
[editorField setAlignment: NSLeftTextAlignment];
[editorField setBordered: NO];
[editorField setEditable: YES];
[editorField setBezeled: YES];
[editorField setDrawsBackground: YES];
[editorField setTarget:self];
[editorField setAction:@selector(setEditor:)];
[v addSubview:[editorField autorelease]];
/*
* Compiler
*/
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(12,48,60,21)];
[textField setAlignment: NSRightTextAlignment];
[textField setBordered: NO];
[textField setEditable: NO];
[textField setBezeled: NO];
[textField setDrawsBackground: NO];
[textField setStringValue:@"Compiler:"];
[v addSubview:[textField autorelease]];
compilerField = [[NSTextField alloc] initWithFrame:NSMakeRect(72,48,184,21)];
[compilerField setAlignment: NSLeftTextAlignment];
[compilerField setBordered: NO];
[compilerField setEditable: YES];
[compilerField setBezeled: YES];
[compilerField setDrawsBackground: YES];
[compilerField setTarget:self];
[compilerField setAction:@selector(setCompiler:)];
[v addSubview:[compilerField autorelease]];
/*
* Debugger
*/
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(12,72,60,21)];
[textField setAlignment: NSRightTextAlignment];
[textField setBordered: NO];
[textField setEditable: NO];
[textField setBezeled: NO];
[textField setDrawsBackground: NO];
[textField setStringValue:@"Debugger:"];
[v addSubview:[textField autorelease]];
debuggerField = [[NSTextField alloc] initWithFrame:NSMakeRect(72,72,184,21)];
[debuggerField setAlignment: NSLeftTextAlignment];
[debuggerField setBordered: NO];
[debuggerField setEditable: YES];
[debuggerField setBezeled: YES];
[debuggerField setDrawsBackground: YES];
[debuggerField setTarget:self];
[debuggerField setAction:@selector(setDebugger:)];
[v addSubview:[debuggerField autorelease]];
v = [[[NSBox alloc] init] autorelease];
[v setTitle:@"Bundles"];
[v setFrameFromContentFrame:NSMakeRect(16,120,228,48)];
[v setFrameFromContentFrame:NSMakeRect(16,120,228,24)];
[prefMiscView addSubview:v];
useExternalEditor = [[[NSButton alloc] initWithFrame:NSMakeRect(32,60,144,15)] autorelease];
[useExternalEditor setTitle:@"use external Editor"];
[useExternalEditor setButtonType:NSSwitchButton];
[useExternalEditor setBordered:NO];
[useExternalEditor setTarget:self];
[useExternalEditor setAction:@selector(setUseExternalEditor:)];
[useExternalEditor setContinuous:NO];
[prefMiscView addSubview:useExternalEditor];
b = [[[NSButton alloc] initWithFrame:NSMakeRect(32,80,144,15)] autorelease];
[b setTitle:@"Prompt when quitting"];
[b setButtonType:NSSwitchButton];
@ -159,7 +238,7 @@
[v addSubview:b];
b = [[[NSButton alloc] initWithFrame:NSMakeRect(13,13,124,15)] autorelease];
[b setTitle:@"Remoe Backup"];
[b setTitle:@"Remove Backup"];
[b setButtonType:NSSwitchButton];
[b setBordered:NO];
[b setTarget:self];
@ -171,8 +250,6 @@
[v setTitle:@"Auto-Save"];
[v setFrameFromContentFrame:NSMakeRect(16,104,228,80)];
[prefSavingView addSubview:v];
_needsReleasing = YES;
}
@end
@ -195,16 +272,16 @@
{
[preferencesDict release];
if (_needsReleasing) {
[prefWindow release];
[prefPopup release];
[prefEmptyView release];
[prefBuildingView release];
[prefMiscView release];
[prefSavingView release];
}
[prefWindow release];
[prefPopup release];
[prefEmptyView release];
[prefBuildingView release];
[prefMiscView release];
[prefSavingView release];
[[NSUserDefaults standardUserDefaults] synchronize];
[super dealloc];
}
@ -214,20 +291,15 @@
id view;
NSString *val;
#if defined(GNUSTEP)
[self _initUI];
#else
if(![NSBundle loadNibNamed:@"Preferences.nib" owner:self]) {
[[NSException exceptionWithName:NIB_NOT_FOUND_EXCEPTION reason:@"Could not load Preferences.gmodel" userInfo:nil] raise];
return;
}
#endif
// Fill in the defaults
[compilerField setStringValue:(val=[preferencesDict objectForKey:Compiler]) ? val : @""];
[debuggerField setStringValue:(val=[preferencesDict objectForKey:Debugger]) ? val : @""];
[editorField setStringValue:(val=[preferencesDict objectForKey:Editor]) ? val : @""];
[bundlePathField setStringValue:(val=[preferencesDict objectForKey:BundlePaths]) ? val : @""];
[useExternalEditor setState:([[preferencesDict objectForKey:ExternalEditor] isEqualToString:@"YES"])?NSOnState:NSOffState];
// The popup and selected view
[prefPopup removeAllItems];
@ -305,40 +377,48 @@
{
}
- (void)setUseExternalEditor:(id)sender
{
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
switch ([[sender selectedCell] state]) {
case 0:
[def setObject:@"NO" forKey:ExternalEditor];
break;
case 1:
[def setObject:@"YES" forKey:ExternalEditor];
break;
}
[def synchronize];
}
- (void)setEditor:(id)sender
{
NSString *path = [self selectFileWithTypes:[NSArray arrayWithObjects:@"app",nil]];
if (path) {
[editorField setStringValue:path];
[[NSUserDefaults standardUserDefaults] setObject:path forKey:Editor];
[preferencesDict setObject:path forKey:Editor];
}
NSString *path = [editorField stringValue];
if (path) {
[[NSUserDefaults standardUserDefaults] setObject:path forKey:Editor];
[preferencesDict setObject:path forKey:Editor];
}
}
- (void)setCompiler:(id)sender
{
NSString *path = [self selectFileWithTypes:nil];
NSString *path = [compilerField stringValue];
if (path) {
[compilerField setStringValue:path];
[[NSUserDefaults standardUserDefaults] setObject:path forKey:Compiler];
[preferencesDict setObject:path forKey:Compiler];
}
if (path) {
[[NSUserDefaults standardUserDefaults] setObject:path forKey:Compiler];
[preferencesDict setObject:path forKey:Compiler];
}
}
- (void)setDebugger:(id)sender
{
NSString *path = [self selectFileWithTypes:nil];
if (path) {
[debuggerField setStringValue:path];
[[NSUserDefaults standardUserDefaults] setObject:path forKey:Debugger];
[preferencesDict setObject:path forKey:Debugger];
}
NSString *path = [debuggerField stringValue];
if (path) {
[[NSUserDefaults standardUserDefaults] setObject:path forKey:Debugger];
[preferencesDict setObject:path forKey:Debugger];
}
}
- (void)setBundlePath:(id)sender
@ -364,23 +444,23 @@
- (NSString *)selectFileWithTypes:(NSArray *)types
{
NSString *file = nil;
NSOpenPanel *openPanel;
int retval;
openPanel = [NSOpenPanel openPanel];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setCanChooseDirectories:YES];
[openPanel setCanChooseFiles:YES];
retval = [openPanel runModalForDirectory:[[NSUserDefaults standardUserDefaults] objectForKey:@"LastOpenDirectory"] file:nil types:types];
if (retval == NSOKButton) {
[[NSUserDefaults standardUserDefaults] setObject:[openPanel directory] forKey:@"LastOpenDirectory"];
file = [[openPanel filenames] objectAtIndex:0];
NSString *file = nil;
NSOpenPanel *openPanel;
int retval;
}
return file;
openPanel = [NSOpenPanel openPanel];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setCanChooseDirectories:YES];
[openPanel setCanChooseFiles:YES];
retval = [openPanel runModalForDirectory:[[NSUserDefaults standardUserDefaults] objectForKey:@"LastOpenDirectory"] file:nil types:types];
if (retval == NSOKButton) {
[[NSUserDefaults standardUserDefaults] setObject:[openPanel directory] forKey:@"LastOpenDirectory"];
file = [[openPanel filenames] objectAtIndex:0];
}
return file;
}
@end

View file

@ -25,7 +25,179 @@
*/
#import <AppKit/AppKit.h>
#import"PCAppController.h"
int main(int argc, const char *argv[]) {
return NSApplicationMain(argc, argv);
void createMenu();
int main(int argc, const char **argv)
{
id theApp;
PCAppController *controller;
id pool = [[NSAutoreleasePool alloc] init];
#ifndef NX_CURRENT_COMPILER_RELEASE
initialize_gnustep_backend();
#endif
theApp = [NSApplication sharedApplication];
createMenu();
controller = [[PCAppController alloc] init];
[theApp setDelegate:controller];
[theApp run];
[controller release];
[pool release];
return 0;
}
void createMenu()
{
NSMenu *menu;
NSMenu *info;
NSMenu *subprojects;
NSMenu *project;
NSMenu *file;
NSMenu *edit;
NSMenu *format;
NSMenu *tools;
NSMenu *services;
NSMenu *windows;
SEL action = @selector(method:);
menu = [[NSMenu alloc] initWithTitle:@"ProjectCenter"];
/*
* The main menu
*/
[menu addItemWithTitle:@"Info" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Project" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"File" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Edit" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Format" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Tools" 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 submenu
*/
info = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:info forItem:[menu itemWithTitle:@"Info"]];
[info addItemWithTitle:@"Info Panel..." action:@selector(showInfoPanel:) keyEquivalent:@""];
[info addItemWithTitle:@"Preferences" action:@selector(showPrefWindow:) keyEquivalent:@""];
[info addItemWithTitle:@"Help" action:action keyEquivalent:@"?"];
/*
* Project submenu
*/
project = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:project forItem:[menu itemWithTitle:@"Project"]];
[project addItemWithTitle:@"Open" action:@selector(openProject:) keyEquivalent:@"o"];
[project addItemWithTitle:@"New" action:@selector(newProject:) keyEquivalent:@"n"];
[project addItemWithTitle:@"Save" action:@selector(saveProject:) keyEquivalent:@"s"];
[project addItemWithTitle:@"Save As" action:@selector(saveProjectAs:) keyEquivalent:@""];
[project addItemWithTitle:@"Subprojects" action:action keyEquivalent:@""];
[project addItemWithTitle:@"Close" action:@selector(closeProject:) keyEquivalent:@""];
subprojects = [[[NSMenu alloc] init] autorelease];
[project setSubmenu:subprojects forItem:[project itemWithTitle:@"Subprojects"]];
[subprojects addItemWithTitle:@"New..." action:@selector(newSubproject:) keyEquivalent:@""];
[subprojects addItemWithTitle:@"Add..." action:@selector(addSubproject:) keyEquivalent:@""];
[subprojects addItemWithTitle:@"Remove..." action:@selector(removeSubproject:) keyEquivalent:@""];
/*
* File submenu
*/
file = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:file forItem:[menu itemWithTitle:@"File"]];
[file addItemWithTitle:@"Open..." action:@selector(openFile:) keyEquivalent:@"O"];
[file addItemWithTitle:@"Add..." action:@selector(addFile:) keyEquivalent:@"A"];
[file addItemWithTitle:@"New in Project" action:@selector(newFile:) keyEquivalent:@"N"];
[file addItemWithTitle:@"Remove File" action:@selector(removeFile:) keyEquivalent:@""];
[file addItemWithTitle:@"Save..." action:@selector(saveFile:) keyEquivalent:@""];
[file addItemWithTitle:@"Save as..." action:@selector(saveFileAs:) keyEquivalent:@""];
[file addItemWithTitle:@"Revert" action:@selector(revertFile:) keyEquivalent:@""];
[file addItemWithTitle:@"Rename" action:@selector(renameFile:) keyEquivalent:@""];
/*
* Edit submenu
*/
edit = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:edit forItem:[menu itemWithTitle:@"Edit"]];
[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"];
/*
* Format submenu
*/
format = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:format forItem:[menu itemWithTitle:@"Format"]];
[format addItemWithTitle:@"Font Panel" action:action keyEquivalent:@""];
/*
* Tools submenu
*/
tools = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:tools forItem:[menu itemWithTitle:@"Tools"]];
[tools addItemWithTitle:@"Loaded Projects..." action:@selector(showLoadedProjects:) keyEquivalent:@""];
[tools addItemWithTitle:@"Build Panel" action:@selector(showBuildPanel:) keyEquivalent:@""];
[tools addItemWithTitle:@"Find Panel" action:@selector(showFindPanel:) keyEquivalent:@"F"];
[tools addItemWithTitle:@"Inspector Panel" action:@selector(showInspector:) keyEquivalent:@""];
/*
* Windows submenu
*/
windows = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:windows forItem:[menu itemWithTitle:@"Windows"]];
[windows addItemWithTitle:@"Arrange"
action:@selector(arrangeInFront:)
keyEquivalent:@""];
[windows addItemWithTitle:@"Miniaturize"
action:@selector(performMiniaturize:)
keyEquivalent:@"m"];
[windows addItemWithTitle:@"Close"
action:@selector(performClose:)
keyEquivalent:@"w"];
/*
* Services submenu
*/
services = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:services forItem:[menu itemWithTitle:@"Services"]];
[[NSApplication sharedApplication] setMainMenu:menu];
[[NSApplication sharedApplication] setServicesMenu: services];
[menu update];
[menu display];
}

Binary file not shown.

Binary file not shown.

View file

@ -7,6 +7,6 @@ GCC_VERSION=2.8.0
# The version number of this release.
MAJOR_VERSION=0
MINOR_VERSION=0
SUBMINOR_VERSION=1
SUBMINOR_VERSION=2
PC_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}
VERSION=${PC_VERSION}