diff --git a/ANNOUNCE b/ANNOUNCE index b4cb9bd..de102b9 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -9,8 +9,8 @@ What is ProjectCenter? The file `INSTALL' gives instructions for installing the package. - The GNUstep web site at `http://www.prjectcenter.ch' contains more - information. + The GNUstep web site at `http://www.projectcenter.ch' contains more + up-to-date information. ProjectCenter is covered under the GNU Public License. This means if you make changes to these programs, you cannot charge a fee, other than @@ -32,11 +32,8 @@ Machines GNUstep ProjectCenter is known to compile on the following machines. - * OpenStep 4.x/m68k - - * OpenStep 4.x/ix86 - - * Linux/GNUstep 0.6.5 + * Linux x86, GNUstep 0.6.6 or newer + * Linux PPC, GNUstep 0.6.6 or newer Where do I send bug reports? ============================ diff --git a/GNUmakefile b/GNUmakefile index 5a02f47..47defd9 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -40,6 +40,7 @@ PACKAGE_NAME = ProjectCenter SUBPROJECTS = \ PCLib \ PCAppProj \ + PCBundleProj \ PCToolProj \ PCLibProj \ PCBaseFileTypes \ diff --git a/INSTALL b/INSTALL index aab1b99..6067e5c 100644 --- a/INSTALL +++ b/INSTALL @@ -8,19 +8,27 @@ distribute, and modify it freely as long as you preserve this copyright notice and permission notice. Installing `ProjectCenter' -==================== +========================= - The ProjectCenter tool runs on OpenStep 4.2 and GNUstep. It's -possible it will run on other versions of OPENSTEP, but it has not been -tried yet. +ProjectCenter requires GNUstep to be installed. Make sure that you have an +up to date version on your system installed! +In order to use apps built with ProjectCenter, you will need at least a +version not older than from October 2000. - Here is a quick-and-dirty example of installation commands: +Here is a quick-and-dirty example of installation commands: +GNUstep: make install; -OPENSTEP 4.2: make; make install + If you want to do make; make install, make sure that you + first make; make install PCLib, and *then* the rest of the + sources! - (or open the project in PB.app and compile it from there) +In order to do this successfully you must first install PCLib and the bundles and then the application itself! -GNUstep: make; make install; +Important! +========== -In order to do this successfully you must first install PCLib and the bundles and then the application itself! \ No newline at end of file +When ProjectCenter fails to launch due to a missing bundle path, you can set it +using GNUstep's defaults tool: + +opentool defaults write ProjectCenter BundlePaths /usr/GNUstep/Local/Library/ProjectCenter diff --git a/PCAppProj/AppController.h b/PCAppProj/AppController.h index 619b67b..21b1ffe 100644 --- a/PCAppProj/AppController.h +++ b/PCAppProj/AppController.h @@ -8,15 +8,27 @@ * $Id$ */ -#import +#import @interface AppController : NSObject { } ++ (void)initialize; + - (id)init; - (void)dealloc; - (void)awakeFromNib; +- (void)applicationDidFinishLaunching:(NSNotification *)notif; + +- (BOOL)applicationShouldTerminate:(id)sender; +- (void)applicationWillTerminate:(NSNotification *)notification; + +- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName; + +- (void)showPrefPanel:(id)sender; +- (void)showInfoPanel:(id)sender; + @end diff --git a/PCAppProj/AppController.m b/PCAppProj/AppController.m index 3829677..8326b06 100644 --- a/PCAppProj/AppController.m +++ b/PCAppProj/AppController.m @@ -12,6 +12,24 @@ @implementation AppController +static NSDictionary *infoDict = nil; + ++ (void)initialize +{ + NSMutableDictionary *defaults = [NSMutableDictionary dictionary]; + + /* + * Register your app's defaults here by adding objects to the + * dictionary, eg + * + * [defaults setObject:anObject forKey:keyForThatObject]; + * + */ + + [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + - (id)init { if ((self = [super init])) { @@ -28,4 +46,29 @@ { } +- (void)applicationDidFinishLaunching:(NSNotification *)notif +{ +} + +- (BOOL)applicationShouldTerminate:(id)sender +{ +} + +- (void)applicationWillTerminate:(NSNotification *)notification +{ +} + +- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName +{ +} + +- (void)showPrefPanel:(id)sender +{ +} + +- (void)showInfoPanel:(id)sender +{ + [[NSApplication sharedApplication] orderFrontStandardInfoPanel:sender]; +} + @end diff --git a/PCAppProj/AppProject.gmodel b/PCAppProj/AppProject.gmodel deleted file mode 100644 index 5dd296b..0000000 --- a/PCAppProj/AppProject.gmodel +++ /dev/null @@ -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; -} diff --git a/PCAppProj/ChangeLog b/PCAppProj/ChangeLog new file mode 100644 index 0000000..ac81615 --- /dev/null +++ b/PCAppProj/ChangeLog @@ -0,0 +1,76 @@ +2000-11-04 13:41 robert + + * PCAppProj.m, PCAppProject.h, PCAppProject.m: we do not use + gmodels, and the project is executable + +2000-10-20 16:49 robert + + * PCAppMakefileFactory.m, PCAppProj.m, PCAppProject.h, + PCAppProject.m: some more UI + +2000-10-15 20:29 robert + + * PCAppProject.m: some code improvements regarding the inspector + +2000-10-15 14:36 robert + + * AppController.h, AppController.m, main.m: fixed the info panel + issue + +2000-10-15 14:25 robert + + * PCAppProj.m: Added the plist file to "Other Resources" + +2000-10-11 09:35 robert + + * AppController.h, AppController.m: removed old method + +2000-10-11 09:33 robert + + * AppController.h, AppController.m, PCAppProj.m, main.m: new info + panel approach - uch simpler, thanks Nicola! + +2000-09-20 17:51 robert + + * ChangeLog: Added a changelog + +2000-09-20 10:50 robert + + * AppController.h, AppController.m, PCAppMakefileFactory.m, + PCAppProj.m, main.m: enhanced the created app to support GC and an + info panel and more ... + +2000-09-17 14:14 robert + + * PCAppProject.h, PCAppProject.m: daily work + +2000-09-14 10:54 robert + + * AppController.h, AppController.m, AppProject.gmodel, GNUmakefile, + Main.gmodel, PC.proj, PCAppMakefileFactory.m, main.m: apps now + don't use gmodels anymore + +2000-09-03 22:10 robert + + * GNUmakefile.preamble: renamed libPC into libProjectCenter + +2000-08-27 21:11 robert + + * Makefile.preamble, PB.project, PCAppProj.h, Makefile, h.template, + m.template, Info.table, PCAppProj.m, Makefile.postamble, + PCAppProject.h, PCAppProject.m, GNUmakefile.postamble, + GNUmakefile.preamble, PC.proj, main.m, PCAppMakefileFactory.h, + PCAppMakefileFactory.m, AppProject.gmodel, GNUmakefile, + AppController.h, AppController.m, Info-project.plist, Main.gmodel: + Initial revision + +2000-08-27 21:11 robert + + * Makefile.preamble, PB.project, PCAppProj.h, Makefile, h.template, + m.template, Info.table, PCAppProj.m, Makefile.postamble, + PCAppProject.h, PCAppProject.m, GNUmakefile.postamble, + GNUmakefile.preamble, PC.proj, main.m, PCAppMakefileFactory.h, + PCAppMakefileFactory.m, AppProject.gmodel, GNUmakefile, + AppController.h, AppController.m, Info-project.plist, Main.gmodel: + Initial import + diff --git a/PCAppProj/GNUmakefile b/PCAppProj/GNUmakefile index 2bca6e5..7be9c50 100644 --- a/PCAppProj/GNUmakefile +++ b/PCAppProj/GNUmakefile @@ -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 \ diff --git a/PCAppProj/GNUmakefile.preamble b/PCAppProj/GNUmakefile.preamble index f61a96d..49b00fc 100644 --- a/PCAppProj/GNUmakefile.preamble +++ b/PCAppProj/GNUmakefile.preamble @@ -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 += diff --git a/PCAppProj/Main.gmodel b/PCAppProj/Main.gmodel deleted file mode 100644 index ec0303c..0000000 --- a/PCAppProj/Main.gmodel +++ /dev/null @@ -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; -} diff --git a/PCAppProj/PC.proj b/PCAppProj/PC.proj index e78336c..cd0f3b9 100644 --- a/PCAppProj/PC.proj +++ b/PCAppProj/PC.proj @@ -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 = (); diff --git a/PCAppProj/PCAppMakefileFactory.m b/PCAppProj/PCAppMakefileFactory.m index 9e5e694..c662811 100644 --- a/PCAppProj/PCAppMakefileFactory.m +++ b/PCAppProj/PCAppMakefileFactory.m @@ -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"]; @@ -108,7 +108,7 @@ static PCAppMakefileFactory *_factory = nil; enumerator = [[prDict objectForKey:k] objectEnumerator]; while (tmp = [enumerator nextObject]) { - [string appendString:[NSString stringWithFormat:@"\\\nEnglish.lproj/%@ ",tmp]]; + [string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; } } diff --git a/PCAppProj/PCAppProj.m b/PCAppProj/PCAppProj.m index f74d3b3..2ff0a3d 100644 --- a/PCAppProj/PCAppProj.m +++ b/PCAppProj/PCAppProj.m @@ -79,7 +79,9 @@ static PCAppProj *_creator = nil; NSString *_file; NSString *_resourcePath; NSMutableDictionary *dict; - + NSDictionary *infoDict; + NSString *plistFileName; + project = [[[PCAppProject alloc] init] autorelease]; _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"PC" ofType:@"proj"]; @@ -89,10 +91,32 @@ static PCAppProj *_creator = nil; [dict setObject:[path lastPathComponent] forKey:PCProjectName]; [dict setObject:[project principalClass] forKey:PCProjType]; + // Create the AppNameInfo.plist + infoDict = [NSDictionary dictionaryWithObjectsAndKeys: + @"Automatically generated!",@"NOTE", + [path lastPathComponent],@"ApplicationName", + @"",@"ApplicationDescription", + @"",@"ApplicationIcon", + @"0.1",@"ApplicationRelease", + @"0.1",@"FullVersionID", + @"",@"Authors", + @"",@"URL", + @"Copyright (C) 200x by ...",@"Copyright", + @"Released under ...",@"CopyrightDescription", nil]; + plistFileName = [NSString stringWithFormat:@"%@Info.plist",[path lastPathComponent]]; + [infoDict writeToFile:[path stringByAppendingPathComponent:plistFileName] atomically:YES]; + + [dict setObject:[NSArray arrayWithObjects:plistFileName,nil] + forKey:PCOtherResources]; + // Save the project to disc [dict writeToFile:[path stringByAppendingPathComponent:@"PC.project"] atomically:YES]; + + /* + * Copy the project files to the provided path + * + */ - // Copy the project files to the provided path _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"GNUmakefile" ofType:@"postamble"]; [fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"GNUmakefile.postamble"] handler:nil]; @@ -114,9 +138,6 @@ static PCAppProj *_creator = nil; [fm createDirectoryAtPath:[path stringByAppendingPathComponent:@"Images"] attributes:nil]; [fm createDirectoryAtPath:[path stringByAppendingPathComponent:@"Documentation"] attributes:nil]; - _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"Main" ofType:@"gmodel"]; - [fm copyPath:_file toPath:[_resourcePath stringByAppendingPathComponent:@"Main.gmodel"] handler:nil]; - // The path cannot be in the PC.project file! [project setProjectPath:path]; diff --git a/PCAppProj/PCAppProject.h b/PCAppProj/PCAppProject.h index 0214a94..96dd0ae 100644 --- a/PCAppProj/PCAppProject.h +++ b/PCAppProj/PCAppProject.h @@ -38,8 +38,12 @@ @interface PCAppProject : PCProject { - @private - BOOL _needsAdditionalReleasing; + NSTextField *appClassField; + NSTextField *appImageField; + NSButton *setAppIconButton; + NSButton *clearAppIconButton; + NSImageView *appIconView; + NSImage *icon; } //---------------------------------------------------------------------------- @@ -63,4 +67,15 @@ - (NSArray *)buildTargets; - (NSString *)projectDescription; +- (BOOL)isExecutable; + +- (void)updateValuesFromProjectDict; + +- (void)clearAppIcon:(id)sender; +- (void)setAppIcon:(id)sender; + +- (BOOL)setAppIconWithImageAtPath:(NSString *)path; + @end + + diff --git a/PCAppProj/PCAppProject.m b/PCAppProj/PCAppProject.m index 25e1282..136932c 100644 --- a/PCAppProj/PCAppProject.m +++ b/PCAppProj/PCAppProject.m @@ -43,31 +43,73 @@ - (void)_initUI { - // Always call super!!! + NSTextField *textField; + NSRect frame = {{84,120}, {80, 80}}; + NSBox *_box; + [super _initUI]; - projectAttributeInspectorView = [[NSBox alloc] init]; - [projectAttributeInspectorView setTitlePosition:NSAtTop]; - [projectAttributeInspectorView setBorderType:NSGrooveBorder]; - // [projectAttributeInspectorView addSubview:projectTypePopup]; - [projectAttributeInspectorView sizeToFit]; - [projectAttributeInspectorView setAutoresizingMask:NSViewWidthSizable]; + textField =[[NSTextField alloc] initWithFrame:NSMakeRect(16,256,64,21)]; + [textField setAlignment: NSRightTextAlignment]; + [textField setBordered: NO]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"App class:"]; + [projectProjectInspectorView addSubview:[textField autorelease]]; + + appClassField =[[NSTextField alloc] initWithFrame:NSMakeRect(84,256,176,21)]; + [appClassField setAlignment: NSLeftTextAlignment]; + [appClassField setBordered: YES]; + [appClassField setEditable: YES]; + [appClassField setBezeled: YES]; + [appClassField setDrawsBackground: YES]; + [appClassField setStringValue:@""]; + [projectProjectInspectorView addSubview:appClassField]; + + textField =[[NSTextField alloc] initWithFrame:NSMakeRect(16,204,64,21)]; + [textField setAlignment: NSRightTextAlignment]; + [textField setBordered: NO]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"App icon:"]; + [projectProjectInspectorView addSubview:[textField autorelease]]; + + appImageField =[[NSTextField alloc] initWithFrame:NSMakeRect(84,204,176,21)]; + [appImageField setAlignment: NSLeftTextAlignment]; + [appImageField setBordered: YES]; + [appImageField setEditable: NO]; + [appImageField setBezeled: YES]; + [appImageField setDrawsBackground: YES]; + [appImageField setStringValue:@""]; + [projectProjectInspectorView addSubview:appImageField]; + + setAppIconButton =[[NSButton alloc] initWithFrame:NSMakeRect(220,180,40,21)]; + [setAppIconButton setTitle:@"Set"]; + [setAppIconButton setTarget:self]; + [setAppIconButton setAction:@selector(setAppIcon:)]; + [projectProjectInspectorView addSubview:setAppIconButton]; + + clearAppIconButton =[[NSButton alloc] initWithFrame:NSMakeRect(180,180,40,21)]; + [clearAppIconButton setTitle:@"Clear"]; + [clearAppIconButton setTarget:self]; + [clearAppIconButton setAction:@selector(clearAppIcon:)]; + [projectProjectInspectorView addSubview:clearAppIconButton]; + + _box = [[NSBox alloc] init]; + [_box setFrame:frame]; + [_box setTitlePosition:NSNoTitle]; + [_box setBorderType:NSBezelBorder]; + [projectProjectInspectorView addSubview:_box]; - projectProjectInspectorView = [[NSBox alloc] init]; - [projectProjectInspectorView setTitlePosition:NSAtTop]; - [projectProjectInspectorView setBorderType:NSGrooveBorder]; - // [projectProjectInspectorView addSubview:projectTypePopup]; - [projectProjectInspectorView sizeToFit]; - [projectProjectInspectorView setAutoresizingMask:NSViewWidthSizable]; - - projectFileInspectorView = [[NSBox alloc] init]; - [projectFileInspectorView setTitlePosition:NSAtTop]; - [projectFileInspectorView setBorderType:NSGrooveBorder]; - // [projectFileInspectorView addSubview:projectTypePopup]; - [projectFileInspectorView sizeToFit]; - [projectFileInspectorView setAutoresizingMask:NSViewWidthSizable]; - - _needsAdditionalReleasing = YES; + appIconView = [[NSImageView alloc] initWithFrame:frame]; + [_box addSubview:appIconView]; + + RELEASE(_box); + RELEASE(setAppIconButton); + RELEASE(clearAppIconButton); + RELEASE(appIconView); } @end @@ -80,42 +122,31 @@ - (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]; + [rootCategories release]; + [appClassField release]; + [appImageField release]; - if (_needsAdditionalReleasing) { - [projectAttributeInspectorView release]; - [projectProjectInspectorView release]; - [projectFileInspectorView release]; - } - - [super dealloc]; + [super dealloc]; } //---------------------------------------------------------------------------- @@ -140,6 +171,7 @@ NSLog([NSString stringWithFormat:@"Couldn't build the GNUmakefile %@!",makefile]); return NO; } + if (![content writeToFile:makefile atomically:YES]) { NSLog([NSString stringWithFormat:@"Couldn't write the GNUmakefile %@!",makefile]); return NO; @@ -177,4 +209,71 @@ return @"Project that handles GNUstep/ObjC based applications."; } +- (BOOL)isExecutable +{ + return YES; +} + +- (void)updateValuesFromProjectDict +{ + [super updateValuesFromProjectDict]; + + [appClassField setStringValue:[projectDict objectForKey:PCAppClass]]; + [appImageField setStringValue:[projectDict objectForKey:PCAppIcon]]; +} + +- (void)clearAppIcon:(id)sender +{ + [projectDict setObject:@"" forKey:PCAppIcon]; + [appImageField setStringValue:@"No Icon!"]; + [appIconView setImage:nil]; + [appIconView display]; + [self writeMakefile]; +} + +- (void)setAppIcon:(id)sender +{ + int result; + NSArray *fileTypes = [NSImage imageFileTypes]; + NSOpenPanel *openPanel = [NSOpenPanel openPanel]; + + [openPanel setAllowsMultipleSelection:NO]; + result = [openPanel runModalForDirectory:NSHomeDirectory() + file:nil + types:fileTypes]; + + if (result == NSOKButton) { + NSArray *files = [openPanel filenames]; + NSString *imageFilePath = [files objectAtIndex:0]; + + if (![self setAppIconWithImageAtPath:imageFilePath]) { + NSRunAlertPanel(@"Error while opening file!", + @"Couldn't open %@", @"OK", nil, nil,imageFilePath); + } + } +} + +- (BOOL)setAppIconWithImageAtPath:(NSString *)path +{ + NSRect frame = {{0,0}, {64, 64}}; + NSImage *image; + + if (!(image = [[NSImage alloc] initWithContentsOfFile:path])) { + return NO; + } + + [self addFile:path forKey:PCImages copy:YES]; + [projectDict setObject:[path lastPathComponent] forKey:PCAppIcon]; + + [appImageField setStringValue:[path lastPathComponent]]; + + frame.size = [image size]; + [appIconView setFrame:frame]; + [appIconView setImage:image]; + [appIconView display]; + RELEASE(image); + + return YES; +} + @end diff --git a/PCAppProj/main.m b/PCAppProj/main.m index 1ef1c5b..3309a05 100644 --- a/PCAppProj/main.m +++ b/PCAppProj/main.m @@ -1,5 +1,106 @@ +/* $Id$ */ + #import +#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; + NSAutoreleasePool *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! + */ + + RELEASE(controller); + RELEASE(pool); + + 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:@selector(showInfoPanel:) keyEquivalent:@""]; + [menu addItemWithTitle:@"Edit" action:action keyEquivalent:@""]; + [menu addItemWithTitle:@"Windows" action:action keyEquivalent:@""]; + [menu addItemWithTitle:@"Services" action:action keyEquivalent:@""]; + [menu addItemWithTitle:@"Hide" action:@selector(hide:) keyEquivalent:@"h"]; + [menu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"]; + + info = AUTORELEASE([[NSMenu alloc] init]); + [menu setSubmenu:info forItem:[menu itemWithTitle:@"Info"]]; + [info addItemWithTitle:@"Info Panel..." action:@selector(showInfoPanel:) keyEquivalent:@""]; + [info addItemWithTitle:@"Preferences" action:@selector(showPrefPanel:) keyEquivalent:@""]; + [info addItemWithTitle:@"Help" action:action keyEquivalent:@"?"]; + + edit = AUTORELEASE([[NSMenu alloc] init]); + [edit addItemWithTitle:@"Cut" action: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 = AUTORELEASE([[NSMenu alloc] init]); + [windows addItemWithTitle:@"Arrange" + action:@selector(arrangeInFront:) + keyEquivalent:@""]; + [windows addItemWithTitle:@"Miniaturize" + action:@selector(performMiniaturize:) + keyEquivalent:@"m"]; + [windows addItemWithTitle:@"Close" + action:@selector(performClose:) + keyEquivalent:@"w"]; + [menu setSubmenu:windows forItem:[menu itemWithTitle:@"Windows"]]; + + services = AUTORELEASE([[NSMenu alloc] init]); + [menu setSubmenu:services forItem:[menu itemWithTitle:@"Services"]]; + + [[NSApplication sharedApplication] setMainMenu:menu]; + [[NSApplication sharedApplication] setServicesMenu: services]; + + [menu update]; + [menu display]; +} + + + diff --git a/PCBaseFileTypes/ChangeLog b/PCBaseFileTypes/ChangeLog new file mode 100644 index 0000000..b62a139 --- /dev/null +++ b/PCBaseFileTypes/ChangeLog @@ -0,0 +1,33 @@ +2000-10-29 13:00 robert + + * protocol.template: updated textfiles and new version coming + soon... + +2000-10-20 17:18 robert + + * GNUmakefile, PCBaseFileType.m, protocol.template: Support for + protocols in file creation + +2000-09-20 17:51 robert + + * ChangeLog: Added a changelog + +2000-09-13 12:45 robert + + * PCBaseFileType.m: removed the gmodels completely from + ProjectCenter.app + +2000-08-27 21:12 robert + + * Makefile, Makefile.postamble, Makefile.preamble, PB.project, + PCBaseFileType.h, PCBaseFileType.m, FileIcon_.m.tiff, + FileIcon_.h.tiff, FileIcon_.c.tiff, GNUmakefile, cfile.template, + cheader.template, class.template, header.template: Initial revision + +2000-08-27 21:12 robert + + * Makefile, Makefile.postamble, Makefile.preamble, PB.project, + PCBaseFileType.h, PCBaseFileType.m, FileIcon_.m.tiff, + FileIcon_.h.tiff, FileIcon_.c.tiff, GNUmakefile, cfile.template, + cheader.template, class.template, header.template: Initial import + diff --git a/PCBaseFileTypes/GNUmakefile b/PCBaseFileTypes/GNUmakefile index 60b285a..0a65782 100644 --- a/PCBaseFileTypes/GNUmakefile +++ b/PCBaseFileTypes/GNUmakefile @@ -38,7 +38,8 @@ PCBaseFileTypes_RESOURCE_FILES = \ cfile.template \ cheader.template \ class.template \ - header.template + header.template \ + protocol.template -include GNUmakefile.preamble @@ -46,3 +47,4 @@ include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUmakefile.postamble + diff --git a/PCBaseFileTypes/PCBaseFileType.m b/PCBaseFileTypes/PCBaseFileType.m index 66b6c1b..69dfb1d 100644 --- a/PCBaseFileTypes/PCBaseFileType.m +++ b/PCBaseFileTypes/PCBaseFileType.m @@ -31,6 +31,7 @@ #define ObjCHeader @"ObjC Header" #define CFile @"C File" #define CHeaderFile @"C Header" +#define ProtocolFile @"ObjC Protocol" @implementation PCBaseFileType @@ -40,124 +41,138 @@ static NSDictionary *dict = nil; + (id)sharedCreator { - if (!_creator) { - NSDictionary *classDict; - NSDictionary *headerDict; - NSDictionary *ccDict; - NSDictionary *chDict; - - _creator = [[[self class] alloc] init]; - - // Setting up the dictionary needed for registration! - classDict = [NSDictionary dictionaryWithObjectsAndKeys:_creator,@"Creator",PCClasses,@"ProjectKey",nil]; - headerDict = [NSDictionary dictionaryWithObjectsAndKeys:_creator,@"Creator",PCHeaders,@"ProjectKey",nil]; - ccDict = [NSDictionary dictionaryWithObjectsAndKeys:_creator,@"Creator",PCOtherSources,@"ProjectKey",nil]; - chDict = [NSDictionary dictionaryWithObjectsAndKeys:_creator,@"Creator",PCHeaders,@"ProjectKey",nil]; - - dict = [[NSDictionary alloc] initWithObjectsAndKeys:classDict,ObjCClass,headerDict,ObjCHeader,ccDict,CFile,chDict,CHeaderFile,nil]; - } - return _creator; + if (!_creator) { + NSDictionary *classDict; + NSDictionary *headerDict; + NSDictionary *ccDict; + NSDictionary *chDict; + NSDictionary *protocolDict; + + _creator = [[[self class] alloc] init]; + + // Setting up the dictionary needed for registration! + classDict = [NSDictionary dictionaryWithObjectsAndKeys:_creator,@"Creator",PCClasses,@"ProjectKey",nil]; + headerDict = [NSDictionary dictionaryWithObjectsAndKeys:_creator,@"Creator",PCHeaders,@"ProjectKey",nil]; + ccDict = [NSDictionary dictionaryWithObjectsAndKeys:_creator,@"Creator",PCOtherSources,@"ProjectKey",nil]; + chDict = [NSDictionary dictionaryWithObjectsAndKeys:_creator,@"Creator",PCHeaders,@"ProjectKey",nil]; + protocolDict = [NSDictionary dictionaryWithObjectsAndKeys:_creator,@"Creator",PCHeaders,@"ProjectKey",nil]; + + dict = [[NSDictionary alloc] initWithObjectsAndKeys:classDict,ObjCClass,headerDict,ObjCHeader,ccDict,CFile,chDict,CHeaderFile,protocolDict,ProtocolFile,nil]; + } + return _creator; } - (NSString *)name { - return _name; + return _name; } - (NSDictionary *)creatorDictionary { - return dict; + return dict; } - (NSDictionary *)createFileOfType:(NSString *)type path:(NSString *)path project:(PCProject *)aProject { - NSFileManager *fm = [NSFileManager defaultManager]; - NSString *_file; - NSString *newFile = nil; - NSMutableDictionary *files; - - // A class and possibly a header - files = [NSMutableDictionary dictionaryWithCapacity:2]; - - NSLog(@"<%@ %x>: create %@ at %@",[self class],self,type,path); - - /* - * - */ + NSFileManager *fm = [NSFileManager defaultManager]; + NSString *_file; + NSString *newFile = nil; + NSMutableDictionary *files; + + // A class and possibly a header + files = [NSMutableDictionary dictionaryWithCapacity:2]; + + NSLog(@"<%@ %x>: create %@ at %@",[self class],self,type,path); + + /* + * + */ + + if ([type isEqualToString:ObjCClass]) { + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"class" ofType:@"template"]; + newFile = [path stringByAppendingPathExtension:@"m"]; + [fm copyPath:_file toPath:newFile handler:nil]; + [files setObject:ObjCClass forKey:newFile]; - if ([type isEqualToString:ObjCClass]) { - _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"class" ofType:@"template"]; - newFile = [path stringByAppendingPathExtension:@"m"]; - [fm copyPath:_file toPath:newFile handler:nil]; - [files setObject:ObjCClass forKey:newFile]; - - [self replaceTagsInFileAtPath:newFile withProject:aProject type:type]; - - // Should a header be created as well? - newFile = [path stringByAppendingPathExtension:@"h"]; - if (NSRunAlertPanel(@"Attention!",@"Should %@ be created and inserted in the project as well?",@"Yes",@"No",nil,[newFile lastPathComponent])) { - _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"header" ofType:@"template"]; - [fm copyPath:_file toPath:newFile handler:nil]; - - [self replaceTagsInFileAtPath:newFile withProject:aProject type:ObjCHeader]; - [files setObject:ObjCHeader forKey:newFile]; - } + [self replaceTagsInFileAtPath:newFile withProject:aProject type:type]; + + // Should a header be created as well? + newFile = [path stringByAppendingPathExtension:@"h"]; + if (NSRunAlertPanel(@"Attention!",@"Should %@ be created and inserted in the project as well?",@"Yes",@"No",nil,[newFile lastPathComponent])) { + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"header" ofType:@"template"]; + [fm copyPath:_file toPath:newFile handler:nil]; + + [self replaceTagsInFileAtPath:newFile withProject:aProject type:ObjCHeader]; + [files setObject:ObjCHeader forKey:newFile]; + } + } + + /* + * + */ + + else if ([type isEqualToString:CFile]) { + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"cfile" ofType:@"template"]; + newFile = [path stringByAppendingPathExtension:@"c"]; + [fm copyPath:_file toPath:newFile handler:nil]; + [files setObject:CFile forKey:newFile]; + + [self replaceTagsInFileAtPath:newFile withProject:aProject type:type]; + + // Should a header be created as well? + newFile = [path stringByAppendingPathExtension:@"h"]; + if (NSRunAlertPanel(@"Attention!",@"Should %@ be created and inserted in the project as well?",@"Yes",@"No",nil,[newFile lastPathComponent])) { + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"cheader" ofType:@"template"]; + [fm copyPath:_file toPath:newFile handler:nil]; + + [self replaceTagsInFileAtPath:newFile withProject:aProject type:CHeaderFile]; + [files setObject:CHeaderFile forKey:newFile]; } + } + + /* + * + */ + + else if ([type isEqualToString:ObjCHeader]) { + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"header" ofType:@"template"]; + newFile = [path stringByAppendingPathExtension:@"h"]; + [fm copyPath:_file toPath:newFile handler:nil]; + [self replaceTagsInFileAtPath:newFile withProject:aProject type:type]; + [files setObject:ObjCHeader forKey:newFile]; + } + + /* + * + */ + + else if ([type isEqualToString:CHeaderFile]) { + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"cheader" ofType:@"template"]; + newFile = [path stringByAppendingPathExtension:@"h"]; + [fm copyPath:_file toPath:newFile handler:nil]; + [self replaceTagsInFileAtPath:newFile withProject:aProject type:type]; + [files setObject:CHeaderFile forKey:newFile]; + } - /* - * - */ - - else if ([type isEqualToString:CFile]) { - _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"cfile" ofType:@"template"]; - newFile = [path stringByAppendingPathExtension:@"c"]; - [fm copyPath:_file toPath:newFile handler:nil]; - [files setObject:CFile forKey:newFile]; - - [self replaceTagsInFileAtPath:newFile withProject:aProject type:type]; - - // Should a header be created as well? - newFile = [path stringByAppendingPathExtension:@"h"]; - if (NSRunAlertPanel(@"Attention!",@"Should %@ be created and inserted in the project as well?",@"Yes",@"No",nil,[newFile lastPathComponent])) { - _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"cheader" ofType:@"template"]; - [fm copyPath:_file toPath:newFile handler:nil]; - - [self replaceTagsInFileAtPath:newFile withProject:aProject type:CHeaderFile]; - [files setObject:CHeaderFile forKey:newFile]; - } - } - - /* - * - */ - - else if ([type isEqualToString:ObjCHeader]) { - _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"header" ofType:@"template"]; - newFile = [path stringByAppendingPathExtension:@"h"]; - [fm copyPath:_file toPath:newFile handler:nil]; - [self replaceTagsInFileAtPath:newFile withProject:aProject type:type]; - [files setObject:ObjCHeader forKey:newFile]; - } - - /* - * - */ - - else if ([type isEqualToString:CHeaderFile]) { - _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"cheader" ofType:@"template"]; - newFile = [path stringByAppendingPathExtension:@"h"]; - [fm copyPath:_file toPath:newFile handler:nil]; - [self replaceTagsInFileAtPath:newFile withProject:aProject type:type]; - [files setObject:ObjCHeader forKey:newFile]; - } - - /* - * Notify the browser! - */ - - [[NSNotificationCenter defaultCenter] postNotificationName:@"ProjectDictDidChangeNotification" object:self]; - - return files; + /* + * + */ + + else if ([type isEqualToString:ProtocolFile]) { + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"protocol" ofType:@"template"]; + newFile = [path stringByAppendingPathExtension:@"h"]; + [fm copyPath:_file toPath:newFile handler:nil]; + [self replaceTagsInFileAtPath:newFile withProject:aProject type:type]; + [files setObject:ProtocolFile forKey:newFile]; + } + + /* + * Notify the browser! + */ + + [[NSNotificationCenter defaultCenter] postNotificationName:@"ProjectDictDidChangeNotification" object:self]; + + return files; } - (void)replaceTagsInFileAtPath:(NSString *)newFile withProject:(PCProject *)aProject type:(NSString *)aType @@ -166,7 +181,7 @@ static NSDictionary *dict = nil; NSString *pname = [aProject projectName]; NSString *date = [[NSCalendarDate calendarDate] description]; NSString *aFile = [newFile lastPathComponent]; - + file = [[NSMutableString stringWithContentsOfFile:newFile] retain]; [file replaceCharactersInRange: @@ -183,6 +198,7 @@ static NSDictionary *dict = nil; if ([aType isEqualToString:ObjCClass] || [aType isEqualToString:CFile] || + [aType isEqualToString:ProtocolFile] || [aType isEqualToString:ObjCHeader]) { NSString *name = [aFile stringByDeletingPathExtension]; @@ -194,6 +210,7 @@ static NSDictionary *dict = nil; [file rangeOfString:@"$FILENAMESANSEXTENSION$"] withString:name]; } } + [file writeToFile:newFile atomically:YES]; [file autorelease]; } diff --git a/PCBaseFileTypes/protocol.template b/PCBaseFileTypes/protocol.template new file mode 100644 index 0000000..db356f9 --- /dev/null +++ b/PCBaseFileTypes/protocol.template @@ -0,0 +1,13 @@ +/* + * $FILENAME$ created by $USERNAME$ on $DATE$ + * + * Project $PROJECTNAME$ + * + * Created with ProjectCenter - http://www.projectcenter.ch + * + * $Id$ + */ + +@protocol $FILENAMESANSEXTENSION$ + +@end diff --git a/PCBundleProj/ChangeLog b/PCBundleProj/ChangeLog new file mode 100644 index 0000000..6fa8285 --- /dev/null +++ b/PCBundleProj/ChangeLog @@ -0,0 +1,8 @@ +2000-11-04 14:22 robert + + * GNUmakefile, GNUmakefile.postamble, GNUmakefile.preamble, + Info.table, PC.proj, PCBundleMakefileFactory.h, + PCBundleMakefileFactory.m, PCBundleProj.h, PCBundleProj.m, + PCBundleProject.h, PCBundleProject.m: the new bundle project type - + probably not 100% correct but working + diff --git a/PCBundleProj/GNUmakefile b/PCBundleProj/GNUmakefile new file mode 100644 index 0000000..b2a0e1c --- /dev/null +++ b/PCBundleProj/GNUmakefile @@ -0,0 +1,50 @@ +# GNUmakefile +# +# Copyright (C) 2000 Philippe C.D. Robert +# +# Author: Philippe C.D. Robert +# Date: 2000 +# +# This file is part of ProjectCenter +# +# This program 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 program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +include $(GNUSTEP_MAKEFILES)/common.make + +BUNDLE_NAME = PCBundleProj +BUNDLE_EXTENSION =.bundle +BUNDLE_INSTALL_DIR =$(GNUSTEP_LOCAL_ROOT)/Library/ProjectCenter/ + +PCBundleProj_OBJC_FILES = \ + PCBundleProj.m \ + PCBundleMakefileFactory.m \ + PCBundleProject.m + +PCBundleProj_HEADERS= \ + PCBundleMakefileFactory.h \ + PCBundleProj.h \ + PCBundleProject.h + +PCBundleProj_PRINCIPAL_CLASS = PCBundleProj + +PCBundleProj_RESOURCE_FILES = \ + PC.proj + +-include GNUmakefile.preamble + +include $(GNUSTEP_MAKEFILES)/bundle.make + +-include GNUmakefile.postamble + diff --git a/PCBundleProj/GNUmakefile.postamble b/PCBundleProj/GNUmakefile.postamble new file mode 100644 index 0000000..c85b08f --- /dev/null +++ b/PCBundleProj/GNUmakefile.postamble @@ -0,0 +1,30 @@ +# +# Makefile.postamble +# +# Copyright (C) 1997 Free Software Foundation, Inc. +# +# Original Author: Scott Christley +# +# This file is part of the GNUstep ProjectCenter. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# If you are interested in a warranty or support for this source code, +# contact Scott Christley at scottc@net-community.com +# +# You should have received a copy of the GNU Library General Public +# License along with this library; see the file COPYING.LIB. +# If not, write to the Free Software Foundation, +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + + + diff --git a/PCBundleProj/GNUmakefile.preamble b/PCBundleProj/GNUmakefile.preamble new file mode 100644 index 0000000..49b00fc --- /dev/null +++ b/PCBundleProj/GNUmakefile.preamble @@ -0,0 +1,74 @@ +# +# Makefile.preamble +# +# Copyright (C) 1997 Free Software Foundation, Inc. +# +# Original Author: Scott Christley +# +# This file is part of the GNUstep ProjectCenter. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# If you are interested in a warranty or support for this source code, +# contact Scott Christley at scottc@net-community.com +# +# You should have received a copy of the GNU Library General Public +# License along with this library; see the file COPYING.LIB. +# If not, write to the Free Software Foundation, +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# +# Makefile.preamble +# +# Project specific makefile variables, and additional +# +# Do not put any Makefile rules in this file, instead they should +# be put into Makefile.postamble. +# + +# +# Flags dealing with compiling and linking +# + +# Additional flags to pass to the preprocessor +ADDITIONAL_CPPFLAGS += + +# Additional flags to pass to the Objective-C compiler +ADDITIONAL_OBJCFLAGS += + +# Additional flags to pass to the C compiler +ADDITIONAL_CFLAGS += +#ADDITIONAL_CFLAGS += + +# Additional include directories the compiler should search +ADDITIONAL_INCLUDE_DIRS += + +# Additional LDFLAGS to pass to the linker +ADDITIONAL_LDFLAGS += -lProjectCenter + +# Additional library directories the linker should search +ADDITIONAL_LIB_DIRS += + +ADDITIONAL_TOOL_LIBS += + +# +# Flags dealing with installing and uninstalling +# + +# Additional directories to be created during installation +ADDITIONAL_INSTALL_DIRS += + +# +# Local configuration +# + + + diff --git a/PCBundleProj/Info.table b/PCBundleProj/Info.table new file mode 100644 index 0000000..e0861e8 --- /dev/null +++ b/PCBundleProj/Info.table @@ -0,0 +1,29 @@ +{ + AdditionalAttributes = { + PrincipalClass = {ATTR_CLASS_NAME = "NSString";}; + }; + Allowable_SubprojectTypes = (Subproject, Bundle, Tool, Framework, Library, Palette); + AttributesInspector = ApplicationInspector; + DefaultExtension = ""; + Default_Localizable_Keys = (INTERFACES); + GeneratedFiles = (Makefile, iconHeader); + INSTALLFLAGS = "-c -s -m 755"; + InfoName = ""; + Localizable_Keys = (INTERFACES, IMAGES, OTHER_RESOURCES, HELP_RESOURCES); + MAKEFILE = app.make; + MAKEFILEDIR = "$(MAKEFILEPATH)/pb_makefiles"; + Other_Keys = (HELP_RESOURCES, OTHER_SOURCES, FRAMEWORKS, OTHER_LIBS); + PBProjectTypeSubClass = "PBApplicationProjectType"; + ProvidesIcons = Yes; + Public_Keys = (H_FILES); + Resource_Keys = (INTERFACES, IMAGES, OTHER_RESOURCES); + SOURCEMODE = 444; + Source_Keys = (CLASSES, H_FILES, OTHER_LINKED); + Subproj_Keys = (SUBPROJECTS); + Targets = (app, debug, profile, install); + ExecutableResults = ( + "$PROJECTNAME$.app/$PROJECTNAME$$EXECUTABLE_EXT$", + "$PROJECTNAME$.debug/$PROJECTNAME$$EXECUTABLE_EXT$", + "$PROJECTNAME$.profile/$PROJECTNAME$$EXECUTABLE_EXT$" + ); +} diff --git a/PCBundleProj/PC.proj b/PCBundleProj/PC.proj new file mode 100644 index 0000000..49cd36e --- /dev/null +++ b/PCBundleProj/PC.proj @@ -0,0 +1,34 @@ +{ + APPCLASS = "NSApplication"; + APPKIT = "GNUSTEP-GUI"; + APPLICATIONICON = ""; + BUILDTOOL = "gnumake"; + CLASS_FILES = (); + COMPILEROPTIONS = ""; + CREATION_DATE = ""; + DOCU_FILES = (); + FOUNDATION = "GNUSTEP-BASE"; + FRAMEWORKS = (); + HEADER_FILES = (); + INTERFACES = (); + IMAGES = (); + LANGUAGE = "English"; + LAST_EDITING = ""; + LIBRARIES = ("gnustep-base"); + MAININTERFACE = ""; + MAKEFILEDIR = "/usr/GNUstep/System/Makefiles"; + INSTALLDIR = "$(HOME)/Apps"; + OTHER_FILES = (); + OTHER_RESOURCES = (); + OTHER_SOURCES = (); + PRINCIPAL_CLASS = ""; + PROJECT_CREATOR = ""; + PROJECT_DESCRIPTION = "No description avaliable!"; + PROJECT_MAINTAINER = ""; + PROJECT_NAME = ""; + PROJECT_TYPE = "Bundle"; + PROJECT_BUILDER = "PCBundleProj"; + PROJECT_VERSION = 1.0; + SUBPROJECTS = (); + SUPPORTING_FILES = ("GNUmakefile.preamble", "GNUmakefile", "GNUmakefile.postamble"); +} diff --git a/PCBundleProj/PCBundleMakefileFactory.h b/PCBundleProj/PCBundleMakefileFactory.h new file mode 100644 index 0000000..842994a --- /dev/null +++ b/PCBundleProj/PCBundleMakefileFactory.h @@ -0,0 +1,38 @@ +/* + GNUstep ProjectCenter - http://www.projectcenter.ch + + Copyright (C) 2000 Philippe C.D. Robert + + Author: Philippe C.D. Robert + + 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 +#import + +@interface PCBundleMakefileFactory : NSObject +{ +} + ++ (PCBundleMakefileFactory *)sharedFactory; + +- (NSData *)makefileForProject:(PCProject *)aProject; + +@end diff --git a/PCBundleProj/PCBundleMakefileFactory.m b/PCBundleProj/PCBundleMakefileFactory.m new file mode 100644 index 0000000..44065ee --- /dev/null +++ b/PCBundleProj/PCBundleMakefileFactory.m @@ -0,0 +1,161 @@ +/* + GNUstep ProjectCenter - http://www.projectcenter.ch + + Copyright (C) 2000 Philippe C.D. Robert + + Author: Philippe C.D. Robert + + 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 "PCBundleMakefileFactory.h" + +@implementation PCBundleMakefileFactory + +static PCBundleMakefileFactory *_factory = nil; + ++ (PCBundleMakefileFactory *)sharedFactory +{ + if (!_factory) { + _factory = [[[self class] alloc] init]; + } + return _factory; +} + +- (NSData *)makefileForProject:(PCProject *)aProject; +{ + NSMutableString *string = [NSMutableString string]; + NSString *prName = [aProject projectName]; + NSDictionary *prDict = [aProject projectDict]; + NSString *tmp; + NSEnumerator *enumerator; + int i; + NSString *installDir = [NSString stringWithString:@"$(GNUSTEP_LOCAL_ROOT)/Library/Bundles"]; + + // Header information + [string appendString:@"#\n"]; + [string appendString:@"# GNUmakefile - Generated by the ProjectCenter\n"]; + [string appendString:@"# Written by Philippe C.D. Robert \n"]; + [string appendString:@"#\n"]; + [string appendString:@"# NOTE: Do NOT change this file -- ProjectCenter maintains it!\n"]; + [string appendString:@"#\n"]; + [string appendString:@"# Put all of your customisations in GNUmakefile.preamble and\n"]; + [string appendString:@"# GNUmakefile.postamble\n"]; + [string appendString:@"#\n\n"]; + + // The 'real' thing + [string appendString:@"include $(GNUSTEP_MAKEFILES)/common.make\n"]; + + [string appendString:@"#\n\n"]; + [string appendString:@"# Subprojects\n"]; + [string appendString:@"#\n\n"]; + + if ([[aProject subprojects] count]) { + enumerator = [[prDict objectForKey:PCSubprojects] objectEnumerator]; + while (tmp = [enumerator nextObject]) { + [string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; + } + } + + [string appendString:@"#\n"]; + [string appendString:@"# Bundle\n"]; + [string appendString:@"#\n\n"]; + + [string appendString:[NSString stringWithFormat:@"BUNDLE_NAME=%@\n",prName]]; + [string appendString:[NSString stringWithFormat:@"BUNDLE_EXTENSION=.bundle\n"]]; + [string appendString:[NSString stringWithFormat:@"BUNDLE_INSTALL_DIR=%@\n",installDir]]; + if ([prDict objectForKey:PCPrincipalClass]) { + [string appendString:[NSString stringWithFormat:@"%@_PRINCIPAL_CLASS=%@\n",prName,[prDict objectForKey:PCPrincipalClass]]]; + } + + [string appendString:@"#\n\n"]; + [string appendString:@"# Additional libraries\n"]; + [string appendString:@"#\n\n"]; + + [string appendString:[NSString stringWithFormat:@"%@_LIBRARIES_DEPEND_UPON += ",prName]]; + + if ([[prDict objectForKey:PCLibraries] count]) { + enumerator = [[prDict objectForKey:PCLibraries] objectEnumerator]; + while (tmp = [enumerator nextObject]) { + if (![tmp isEqualToString:@"gnustep-base"] && + ![tmp isEqualToString:@"gnustep-gui"]) { + [string appendString:[NSString stringWithFormat:@"-l%@ ",tmp]]; + } + } + } + + [string appendString:@"\n\n#\n\n"]; + [string appendString:@"# Resource files\n"]; + [string appendString:@"#\n\n"]; + + [string appendString:[NSString stringWithFormat:@"%@_RESOURCE_FILES= ",prName]]; + + for (i=0;i<[[aProject resourceFileKeys] count];i++) { + NSString *k = [[aProject resourceFileKeys] objectAtIndex:i]; + + enumerator = [[prDict objectForKey:k] objectEnumerator]; + while (tmp = [enumerator nextObject]) { + [string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; + } + } + + [string appendString:@"\n\n#\n\n"]; + [string appendString:@"# Header files\n"]; + [string appendString:@"#\n\n"]; + + [string appendString:[NSString stringWithFormat:@"%@_HEADERS= ",prName]]; + + enumerator = [[prDict objectForKey:PCHeaders] objectEnumerator]; + while (tmp = [enumerator nextObject]) { + [string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; + } + + [string appendString:@"\n\n#\n\n"]; + [string appendString:@"# Class files\n"]; + [string appendString:@"#\n\n"]; + + [string appendString:[NSString stringWithFormat:@"%@_OBJC_FILES= ",prName]]; + + enumerator = [[prDict objectForKey:PCClasses] objectEnumerator]; + while (tmp = [enumerator nextObject]) { + [string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; + } + + [string appendString:@"\n\n#\n\n"]; + [string appendString:@"# C files\n"]; + [string appendString:@"#\n\n"]; + + [string appendString:[NSString stringWithFormat:@"%@_C_FILES= ",prName]]; + + enumerator = [[prDict objectForKey:PCOtherSources] objectEnumerator]; + while (tmp = [enumerator nextObject]) { + [string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; + } + + [string appendString:@"\n\n"]; + + [string appendString:@"-include GNUmakefile.preamble\n"]; + [string appendString:@"-include GNUmakefile.local\n"]; + [string appendString:@"include $(GNUSTEP_MAKEFILES)/bundle.make\n"]; + [string appendString:@"-include GNUmakefile.postamble\n"]; + + return [string dataUsingEncoding:[NSString defaultCStringEncoding]]; +} + +@end diff --git a/PCBundleProj/PCBundleProj.h b/PCBundleProj/PCBundleProj.h new file mode 100644 index 0000000..89fa92a --- /dev/null +++ b/PCBundleProj/PCBundleProj.h @@ -0,0 +1,49 @@ +/* + GNUstep ProjectCenter - http://www.projectcenter.ch + + Copyright (C) 2000 Philippe C.D. Robert + + Author: Philippe C.D. Robert + + 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 +#import + +@interface PCBundleProj : NSObject +{ +} + +//---------------------------------------------------------------------------- +// ProjectType +//---------------------------------------------------------------------------- + ++ (id)sharedCreator; + +- (Class)projectClass; + +- (NSString *)projectTypeName; +- (NSDictionary *)typeTable; + +- (PCProject *)createProjectAt:(NSString *)path; +- (PCProject *)openProjectAt:(NSString *)path; + +@end + diff --git a/PCBundleProj/PCBundleProj.m b/PCBundleProj/PCBundleProj.m new file mode 100644 index 0000000..cf7a0a2 --- /dev/null +++ b/PCBundleProj/PCBundleProj.m @@ -0,0 +1,145 @@ +/* + GNUstep ProjectCenter - http://www.projectcenter.ch + + Copyright (C) 2000 Philippe C.D. Robert + + Author: Philippe C.D. Robert + + 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$ +*/ + +/* + Description: + + PCBundleProj creates new project of the type Application! + +*/ + +#import "PCBundleProj.h" +#import "PCBundleProject.h" + +@implementation PCBundleProj + +static NSString *_projTypeName = @"Bundle"; +static PCBundleProj *_creator = nil; + +//---------------------------------------------------------------------------- +// ProjectType +//---------------------------------------------------------------------------- + ++ (id)sharedCreator +{ + if (!_creator) { + _creator = [[[self class] alloc] init]; + } + return _creator; +} + +- (Class)projectClass +{ + return [PCBundleProject class]; +} + +- (NSString *)projectTypeName +{ + return _projTypeName; +} + +- (NSDictionary *)typeTable +{ + NSString *_path = [[NSBundle bundleForClass:[self class]] + pathForResource:@"Info" ofType:@"table"]; + + return [NSDictionary dictionaryWithContentsOfFile:_path]; +} + +- (PCProject *)createProjectAt:(NSString *)path +{ + PCBundleProject *project = nil; + NSFileManager *fm = [NSFileManager defaultManager]; + + NSAssert(path,@"No valid project path provided!"); + + if ([fm createDirectoryAtPath:path attributes:nil]) { + NSString *_file; + NSString *_resourcePath; + NSMutableDictionary *dict; + + project = [[[PCBundleProject alloc] init] autorelease]; + + _file = [[NSBundle bundleForClass:[self class]] + pathForResource:@"PC" ofType:@"proj"]; + dict = [NSMutableDictionary dictionaryWithContentsOfFile:_file]; + + // Customise the project + [dict setObject:[path lastPathComponent] forKey:PCProjectName]; + [dict setObject:[project principalClass] forKey:PCProjType]; + + // Save the project to disc + [dict writeToFile:[path stringByAppendingPathComponent:@"PC.project"] + atomically:YES]; + + /* + * Copy the project files to the provided path + * + */ + + _file = [[NSBundle bundleForClass:[self class]] + pathForResource:@"GNUmakefile" ofType:@"postamble"]; + [fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"GNUmakefile.postamble"] handler:nil]; + + _file = [[NSBundle bundleForClass:[self class]] + pathForResource:@"GNUmakefile" ofType:@"preamble"]; + [fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"GNUmakefile.preamble"] handler:nil]; + + // Resources + _resourcePath = [path stringByAppendingPathComponent:@"English.lproj"]; + [fm createDirectoryAtPath:_resourcePath attributes:nil]; + [fm createDirectoryAtPath:[path stringByAppendingPathComponent:@"Images"] attributes:nil]; + [fm createDirectoryAtPath:[path stringByAppendingPathComponent:@"Documentation"] attributes:nil]; + + // The path cannot be in the PC.project file! + [project setProjectPath:path]; + + // Set the new dictionary - this causes the GNUmakefile to be written + if(![project assignProjectDict:dict]) { + NSRunAlertPanel(@"Attention!",@"Could not load %@!",@"OK",nil,nil,path); + return nil; + } + } + return project; +} + +- (PCProject *)openProjectAt:(NSString *)path +{ + NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path]; + id obj; + +#ifdef DEBUG + NSLog(@"<%@ %x>: opening project at %@",[self class],self,path); +#endif DEBUG + + obj = [dict objectForKey:PCProjectBuilderClass]; + if ([obj isEqualToString:@"PCBundleProj"]) { + return [[[PCBundleProject alloc] initWithProjectDictionary:dict path:[path stringByDeletingLastPathComponent]] autorelease]; + } + return nil; +} + +@end diff --git a/PCBundleProj/PCBundleProject.h b/PCBundleProj/PCBundleProject.h new file mode 100644 index 0000000..07de78d --- /dev/null +++ b/PCBundleProj/PCBundleProject.h @@ -0,0 +1,68 @@ +/* + GNUstep ProjectCenter - http://www.projectcenter.ch + + Copyright (C) 2000 Philippe C.D. Robert + + Author: Philippe C.D. Robert + + 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$ +*/ + +/* + Description: + + This is the project type 'Application' for GNUstep. You never should create + it yourself but use PCBundleProj for doing this. Otherwise needed files don't + get copied to the right place. + + */ + +#import +#import + +@interface PCBundleProject : PCProject +{ + NSTextField *principalClassField; +} + +//---------------------------------------------------------------------------- +// Init and free +//---------------------------------------------------------------------------- + +- (id)init; +- (void)dealloc; + +//---------------------------------------------------------------------------- +// Project +//---------------------------------------------------------------------------- + +- (BOOL)writeMakefile; + +- (BOOL)isValidDictionary:(NSDictionary *)aDict; + +- (NSArray *)sourceFileKeys; +- (NSArray *)resourceFileKeys; +- (NSArray *)otherKeys; +- (NSArray *)buildTargets; +- (NSString *)projectDescription; + +- (void)updateValuesFromProjectDict; + +@end + diff --git a/PCBundleProj/PCBundleProject.m b/PCBundleProj/PCBundleProject.m new file mode 100644 index 0000000..7082e80 --- /dev/null +++ b/PCBundleProj/PCBundleProject.m @@ -0,0 +1,170 @@ +/* + GNUstep ProjectCenter - http://www.projectcenter.ch + + Copyright (C) 2000 Philippe C.D. Robert + + Author: Philippe C.D. Robert + + 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 "PCBundleProject.h" +#import "PCBundleMakefileFactory.h" + +#import + +@interface PCBundleProject (CreateUI) + +- (void)_initUI; + +@end + +@implementation PCBundleProject (CreateUI) + +- (void)_initUI +{ + NSTextField *textField; + NSRect frame = {{84,120}, {80, 80}}; + NSBox *box; + + [super _initUI]; + + textField =[[NSTextField alloc] initWithFrame:NSMakeRect(16,240,88,21)]; + [textField setAlignment: NSRightTextAlignment]; + [textField setBordered: NO]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"Principal class:"]; + [projectProjectInspectorView addSubview:[textField autorelease]]; + + principalClassField =[[NSTextField alloc] initWithFrame:NSMakeRect(106,240,144,21)]; + [principalClassField setAlignment: NSLeftTextAlignment]; + [principalClassField setBordered: YES]; + [principalClassField setEditable: YES]; + [principalClassField setBezeled: YES]; + [principalClassField setDrawsBackground: YES]; + [principalClassField setStringValue:@""]; + [projectProjectInspectorView addSubview:principalClassField]; +} + +@end + +@implementation PCBundleProject + +//---------------------------------------------------------------------------- +// Init and free +//---------------------------------------------------------------------------- + +- (id)init +{ + 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]; + + [self _initUI]; + } + return self; +} + +- (void)dealloc +{ + [rootCategories release]; + [principalClassField release]; + + [super dealloc]; +} + +//---------------------------------------------------------------------------- +// Project +//---------------------------------------------------------------------------- + +- (BOOL)writeMakefile +{ + NSFileManager *fm = [NSFileManager defaultManager]; + NSString *makefile = [projectPath stringByAppendingPathComponent:@"GNUmakefile"]; + NSData *content; + + if (![super writeMakefile]) { + NSLog(@"Couldn't update PC.project..."); + } + + if (![fm movePath:makefile toPath:[projectPath stringByAppendingPathComponent:@"GNUmakefile~"] handler:nil]) { + NSLog(@"Couldn't write a backup GNUmakefile..."); + } + + if (!(content = [[PCBundleMakefileFactory sharedFactory] makefileForProject:self])) { + NSLog([NSString stringWithFormat:@"Couldn't build the GNUmakefile %@!",makefile]); + return NO; + } + + if (![content writeToFile:makefile atomically:YES]) { + NSLog([NSString stringWithFormat:@"Couldn't write the GNUmakefile %@!",makefile]); + return NO; + } + return YES; +} + +- (BOOL)isValidDictionary:(NSDictionary *)aDict +{ +#warning No project check implemented, yet! + return YES; +} + +- (NSArray *)sourceFileKeys +{ + return [NSArray arrayWithObjects:PCClasses,PCOtherSources,nil]; +} + +- (NSArray *)resourceFileKeys +{ + return [NSArray arrayWithObjects:PCGModels,PCOtherResources,PCImages,nil]; +} + +- (NSArray *)otherKeys +{ + return [NSArray arrayWithObjects:PCDocuFiles,PCSupportingFiles,nil]; +} + +- (NSArray *)buildTargets +{ +} + +- (NSString *)projectDescription +{ + return @"GNUstep Objective-C bundle project"; +} + +- (void)updateValuesFromProjectDict +{ + [super updateValuesFromProjectDict]; + + [principalClassField setStringValue:[projectDict objectForKey:PCPrincipalClass]]; +} + +@end diff --git a/PCLib/ChangeLog b/PCLib/ChangeLog new file mode 100644 index 0000000..270ef89 --- /dev/null +++ b/PCLib/ChangeLog @@ -0,0 +1,161 @@ +2000-11-04 17:47 robert + + * PCBundleLoader.m: the bundle path is now depending on the env + variable + +2000-11-04 14:20 robert + + * PCProject.h, PCProject.m: projects are by default not executable + +2000-11-02 11:21 robert + + * PCProject.m, PCProjectBuilder.m: 2 lines of information when + launching... + +2000-11-01 11:38 robert + + * PCBrowserController.m, PCProject.m: removed logs + +2000-10-29 21:17 robert + + * PCProjectDebugger.h, PCProjectDebugger.m: added the class which + will one day become a simple gdb frontend + +2000-10-29 21:15 robert + + * GNUmakefile, PCBrowserController.m, PCProject.h, PCProject.m, + PCProjectBuilder.h, PCProjectBuilder.m, ProjectCenter.h: new style + interface - simpler but hopefully more usable + +2000-10-29 13:00 robert + + * PCBundleLoader.m, PCProject.m, PCProjectBuilder.h, + PCProjectBuilder.m, PCServer.h, PCServer.m: build logging now + works, as well as some enhancements when using the internal + 'editor' + +2000-10-27 19:15 robert + + * PCProject.h, PCProject.m: removed the 2 popups, which are not + needed on the top right side + +2000-10-26 11:12 robert + + * PCProject.m: more image files are allowed now + +2000-10-20 20:13 robert + + * PCProject.h, PCProjectBuilder.m: new build images in the build + panel + +2000-10-20 17:18 robert + + * PCEditorView.m, PCProject.m: Support for protocols in file + creation + +2000-10-15 20:24 robert + + * PCBrowserController.m, PCProject.h, PCProject.m, + PCProjectBuilder.m, PCProjectManager.m: More UI enhancements - not + really functional yet + +2000-10-15 14:27 robert + + * PCBrowserController.m, PCProject.m, PCProjectBuilder.h, + PCProjectBuilder.m, PCProjectManager.m: typo and note about GNUstep + version added + +2000-09-22 19:11 robert + + * PCProject.h, PCProject.m: minor UI changes + +2000-09-22 12:33 robert + + * PCBrowserController.m, PCProject.h, PCProject.m, + PCProjectBuilder.h, PCProjectBuilder.m: some UI modifications + +2000-09-21 09:36 robert + + * PCBundleLoader.m: bundle path issues + +2000-09-21 07:42 robert + + * PCProjectManager.h, PCProjectManager.m: daily work + +2000-09-21 07:20 robert + + * PCFileManager.m: daily work + +2000-09-21 07:16 robert + + * PCEditorView.m: @end is now highlighted, too + +2000-09-20 17:50 robert + + * ChangeLog: Added a changelog + +2000-09-20 17:46 robert + + * GNUmakefile, PCBrowserController.m, PCEditorView.h, + PCEditorView.m, PCProject.h, PCProject.m, PCServer.m, + ProjectCenter.h: Added a first editor with syntax highlighting + +2000-09-20 11:59 robert + + * PCProjectBuilder.m: daily work + +2000-09-20 11:53 robert + + * PCProject.m, PCProjectBuilder.m: minor UI changes (scrollers in + scrollviews) + +2000-09-19 17:39 robert + + * PCProject.m, PCProjectBuilder.m: sizeToCells was missing ... + +2000-09-17 16:40 robert + + * PCProject.h, PCProject.m, PCProjectBuilder.m: Basic preferences + handling + +2000-09-17 14:13 robert + + * PCBrowserController.h, PCBrowserController.m, PCFileManager.h, + PCFileManager.m, PCProject.h, PCProject.m, PCProjectBuilder.h, + PCProjectBuilder.m, PCProjectManager.h, PCProjectManager.m, + PCServer.h, PCServer.m, ProjectCenter.h, Server.h: Implemented a + first 'editor', UI enhancements and other nice things + +2000-09-03 22:10 robert + + * GNUmakefile: renamed libPC into libProjectCenter + +2000-08-28 21:04 robert + + * PCBrowserController.m, PCFileManager.h: The class and header + files are now being displayed + +2000-08-27 21:12 robert + + * Makefile.preamble, PB.project, h.template, m.template, Makefile, + Makefile.postamble, ProjectEditor.h, Server.h, PCServer.h, + PCServer.m, ProjectCenter.h, ProjectDebugger.h, ProjectType.h, + PCProjectManager.m, PCProjectManager.h, PCBundleLoader.h, + PCBundleLoader.m, PreferenceController.h, ProjectBuilder.h, + PCBrowserController.h, PCDataSource.h, PCDataSource.m, PCProject.h, + PCFileManager.h, PCProject.m, PCFileManager.m, FileCreator.h, + GNUmakefile, GNUmakefile.preamble, PCBrowserController.m, + PCProjectBuilder.h, PCProjectBuilder.m: Initial revision + +2000-08-27 21:12 robert + + * Makefile.preamble, PB.project, h.template, m.template, Makefile, + Makefile.postamble, ProjectEditor.h, Server.h, PCServer.h, + PCServer.m, ProjectCenter.h, ProjectDebugger.h, ProjectType.h, + PCProjectManager.m, PCProjectManager.h, PCBundleLoader.h, + PCBundleLoader.m, PreferenceController.h, ProjectBuilder.h, + PCBrowserController.h, PCDataSource.h, PCDataSource.m, PCProject.h, + PCFileManager.h, PCProject.m, PCFileManager.m, FileCreator.h, + GNUmakefile, GNUmakefile.preamble, PCBrowserController.m, + PCProjectBuilder.h, PCProjectBuilder.m: Initial import + diff --git a/PCLib/GNUmakefile b/PCLib/GNUmakefile index 159db9e..ac46ce9 100644 --- a/PCLib/GNUmakefile +++ b/PCLib/GNUmakefile @@ -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,26 +46,30 @@ FILE_AUTHORS = \ # The source files -libPC_MFILES = \ +libProjectCenter_MFILES = \ PCBrowserController.m \ PCBundleLoader.m \ PCDataSource.m \ + PCEditorView.m \ PCFileManager.m \ PCProject.m \ PCProjectBuilder.m \ + PCProjectDebugger.m \ PCProjectManager.m \ PCServer.m -libPC_CFILES = +libProjectCenter_CFILES = -libPC_HFILES = \ +libProjectCenter_HFILES = \ FileCreator.h \ PCBrowserController.h \ PCBundleLoader.h \ PCDataSource.h \ + PCEditorView.h \ PCFileManager.h \ PCProject.h \ PCProjectBuilder.h \ + PCProjectDebugger.h \ PCProjectManager.h \ PCServer.h \ PreferenceController.h \ @@ -76,18 +80,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 diff --git a/PCLib/PCBrowserController.h b/PCLib/PCBrowserController.h index 39a130e..bc023a8 100644 --- a/PCLib/PCBrowserController.h +++ b/PCLib/PCBrowserController.h @@ -56,3 +56,6 @@ - (BOOL)browser:(NSBrowser *)sender selectCellWithString:(NSString *)title inColumn:(int)column; @end + +extern NSString *FileShouldOpenNotification; + diff --git a/PCLib/PCBrowserController.m b/PCLib/PCBrowserController.m index 6bbc578..e9a4d76 100644 --- a/PCLib/PCBrowserController.m +++ b/PCLib/PCBrowserController.m @@ -26,60 +26,49 @@ #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 { - 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] -]; - pTextView = [project textView]; - - if ([ctitle isEqualToString:@"Classes"]) { - [pTextView setString:text]; - } + NSString *ctitlef = [[project projectPath] stringByAppendingPathComponent:ltitle]; + [project browserDidSelectFileNamed:ltitle]; } } - (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 +90,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 @@ -146,14 +128,16 @@ int count = [files count]; if (count == 0) { - NSLog(@"<%@ %x>: create rows for column aborted - 0 files!",[self class],self); +#ifdef DEBUG + NSLog(@"<%@ %x>: create rows for column in %@ (%x) aborted - 0 files!",[self class],self,[project class],project); +#endif return; } #ifdef DEBUG NSLog(@"<%@ %x>: create rows for column %d in %x",[self class],self,column,sender); #endif DEBUG - + for (i = 0; i < count; ++i) { NSMutableString *keyPath = [NSMutableString stringWithString:pathToCol]; id cell; diff --git a/PCLib/PCBundleLoader.m b/PCLib/PCBundleLoader.m index 3907cf0..f5b4ae0 100644 --- a/PCLib/PCBundleLoader.m +++ b/PCLib/PCBundleLoader.m @@ -101,13 +101,30 @@ NSArray *dir; NSString *path = [[NSUserDefaults standardUserDefaults] objectForKey:BundlePaths]; - if (!path || path == @"" || ![[NSFileManager defaultManager] fileExistsAtPath:path]) { + if (!path || [path isEqualToString:@""]) { + NSDictionary *env = [[NSProcessInfo processInfo] environment]; + NSString *prefix = [env objectForKey:@"GNUSTEP_LOCAL_ROOT"]; + + if (prefix && ![prefix isEqualToString:@""]) { + path =[prefix stringByAppendingPathComponent:@"Library/ProjectCenter"]; + } + else { + path = [NSString stringWithString:@"/usr/GNUstep/Local/Library/ProjectCenter"]; + } + + [[NSUserDefaults standardUserDefaults] setObject:path forKey:BundlePaths]; + [[NSUserDefaults standardUserDefaults] synchronize]; + } + + if (![[NSFileManager defaultManager] fileExistsAtPath:path]) { [NSException raise:@"PCBundleLoaderPathException" format:@"No valid bundle path specified!"]; return; } +#ifdef DEBUG else { NSLog([NSString stringWithFormat:@"Loading bundles at %@",path]); } +#endif DEBUG dir = [[NSFileManager defaultManager] directoryContentsAtPath:path]; enumerator = [dir objectEnumerator]; diff --git a/PCLib/PCEditorView.h b/PCLib/PCEditorView.h new file mode 100644 index 0000000..af11126 --- /dev/null +++ b/PCLib/PCEditorView.h @@ -0,0 +1,53 @@ +/* + GNUstep ProjectCenter - http://www.projectcenter.ch + + Copyright (C) 2000 Philippe C.D. Robert + + Author: Philippe C.D. Robert + + 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 + +@interface PCEditorView : NSTextView +{ + NSScanner *scanner; + + @private + NSRange range; + NSArray *_keywords; +} + +- (id)initWithFrame:(NSRect)frameRect; +- (void)dealloc; + +- (void)setString:(NSString *)aString; + +- (void)colourise:(id)sender; + +- (void)colouriseKeyword:(NSString *)keyword; +- (void)colouriseKeywords:(NSArray *)keywords; + +- (void)colouriseStrings; +- (void)colouriseCharStrings; +- (void)colouriseComments; +- (void)colouriseCPPComments; + +@end diff --git a/PCLib/PCEditorView.m b/PCLib/PCEditorView.m new file mode 100644 index 0000000..316c25b --- /dev/null +++ b/PCLib/PCEditorView.m @@ -0,0 +1,347 @@ +/* + GNUstep ProjectCenter - http://www.projectcenter.ch + + Copyright (C) 2000 Philippe C.D. Robert + + Author: Philippe C.D. Robert + + 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 "PCEditorView.h" + +#define SCANLOC [scanner scanLocation] + +@implementation PCEditorView + +static NSColor *commentColor = nil; +static NSColor *keywordColor = nil; +static NSColor *cppCommentColor = nil; +static NSColor *stringColor = nil; +static NSColor *cStringColor = nil; +static NSFont *editorFont = nil; +static BOOL isInitialised = NO; + +- (id)initWithFrame:(NSRect)frameRect +{ + if ((self = [super initWithFrame:frameRect])) { + + /* + * Should move that to initialize... + */ + + if (isInitialised == NO) { + commentColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.5 blue: 0.0 alpha: 1.0] retain]; + cppCommentColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.5 blue: 0.0 alpha: 1.0] retain]; + keywordColor = [[NSColor colorWithCalibratedRed: 0.8 green: 0.0 blue: 0.0 alpha: 1.0] retain]; + stringColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.0 blue: 0.8 alpha: 1.0] retain]; + cStringColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.0 blue: 0.8 alpha: 1.0] retain]; + editorFont = [[NSFont userFixedPitchFontOfSize:12] retain]; + isInitialised = YES; + } + + _keywords = [[NSArray alloc] initWithObjects:@"@class",@"@selector",@"#import",@"#include",@"#define",@"#pragma",@"#warning",@"@interface",@"@implementation",@"@end",@"@protocol",nil]; + } + return self; +} + +- (void)dealloc +{ + if (scanner) { + [scanner release]; + } + [_keywords release]; + + [super dealloc]; +} + +- (void)setString:(NSString *)aString +{ + [scanner autorelease]; + scanner = [[NSScanner alloc] initWithString:aString]; + + [super setString:aString]; + [self colourise:self]; +} + +- (void)colourise:(id)sender +{ + NSRange aRange; + NSDictionary *aDict; + NSArray *keywords; + + aRange = NSMakeRange(0,[_textStorage length]); + aDict = [NSDictionary dictionaryWithObjectsAndKeys: + editorFont, NSFontAttributeName, + @"UnknownCodeType", @"PCCodeTypeAttributeName", + nil]; + + [_textStorage beginEditing]; + [_textStorage setAttributes:aDict range:aRange]; + + // Scan the CodeType first... + + [self colouriseKeywords:_keywords]; + [self colouriseStrings]; + [self colouriseCharStrings]; + [self colouriseComments]; + [self colouriseCPPComments]; + + /* + * BIG HACK! + */ + + NS_DURING + [_textStorage endEditing]; + NS_HANDLER + NSLog(@"Excpetion: %@",[localException description]); + NS_ENDHANDLER + + [self setNeedsDisplay:YES]; +} + +- (void)colouriseStrings +{ + BOOL foundRange; + id aDict = [NSDictionary dictionaryWithObjectsAndKeys: + stringColor, NSForegroundColorAttributeName, + @"StringConstantCodeType", @"PCCodeTypeAttributeName", nil ]; + + [scanner setScanLocation:0]; + + while( ![scanner isAtEnd] ) { + foundRange = NO; + + [scanner scanUpToString:@"\"" intoString:NULL]; + range.location = SCANLOC; + [scanner scanString:@"\"" intoString:NULL]; + + if( ![scanner isAtEnd] && + range.location > 0 && + [[_textStorage string] characterAtIndex:(SCANLOC - 2)] == '@' ) { + range.location -= 1; + } + + while( ![scanner isAtEnd] ) { + [scanner scanUpToString:@"\"" intoString:NULL]; + [scanner scanString:@"\"" intoString:NULL]; + + // If there is no escape char before then we are done.. + + if( [[scanner string] characterAtIndex:(SCANLOC - 2)] != '\\' || + [[scanner string] characterAtIndex:(SCANLOC - 3)] == '\\' ) { + range.length = SCANLOC - range.location; + foundRange = YES; + break; + } + } + + if( foundRange ) { + NS_DURING + [_textStorage addAttributes:aDict range:range]; + NS_HANDLER + NSLog(@"<%@ %x> raised (-scanForStrings):\n%@",[self class],self,[localException description]); + NS_ENDHANDLER + } + } +} + +- (void)colouriseCharStrings +{ + NSRange tmpRange; + BOOL foundRange; + id aDict = [NSDictionary dictionaryWithObjectsAndKeys: + cStringColor,NSForegroundColorAttributeName, + @"StringConstantCodeType", @"PCCodeTypeAttributeName", nil ]; + + [scanner setScanLocation:0]; + + while( ![scanner isAtEnd] ) { + foundRange = NO; + [scanner scanUpToString:@"'" intoString:NULL]; + range.location = SCANLOC; + [scanner scanString:@"'" intoString:NULL]; + + while( ![scanner isAtEnd] ) { + [scanner scanUpToString:@"'" intoString:NULL]; + [scanner scanString:@"'" intoString:NULL]; + + // No escape => we are done! (ugly hack...) + if( [[scanner string] characterAtIndex:(SCANLOC - 2)] != '\\' || + [[scanner string] characterAtIndex:(SCANLOC - 3)] == '\\' ) { + + range.length = SCANLOC - range.location; + + // Ranges are not longer than 8 chars! (ugly hack...) + if( range.length > 8 ) { + [scanner setScanLocation:SCANLOC - 1]; + } + else { + foundRange = YES; + } + break; + } + } + + if( foundRange ) { + NS_DURING + [_textStorage addAttributes:aDict range:range]; + NS_HANDLER + NSLog(@"<%@ %x> raised (-colouriseCharStrings):\n%@",[self class],self,[localException description]); + NS_ENDHANDLER + } + } +} + +- (void)colouriseComments +{ + NSRange tmpRange; + BOOL foundRange; + id anObject; + id aDict = [NSDictionary dictionaryWithObjectsAndKeys: + commentColor,NSForegroundColorAttributeName, + @"CommentCodeType", @"PCCodeTypeAttributeName", + nil ]; + + [scanner setScanLocation:0]; + + while( ![scanner isAtEnd] ) { + foundRange = NO; + + while( ![scanner isAtEnd] ) { + [scanner scanUpToString:@"/*" intoString:NULL]; + range.location = SCANLOC; + [scanner scanString:@"/*" intoString:NULL]; + + if(![scanner isAtEnd] && + [[_textStorage attribute:@"PCCodeTypeAttributeName" + atIndex:range.location + effectiveRange:&tmpRange] isEqual:@"UnknownCodeType"]){ + foundRange = YES; + break; + } + } + + [scanner scanUpToString:@"*/" intoString:NULL]; + [scanner scanString:@"*/" intoString:NULL]; + range.length = SCANLOC - range.location; + + if( foundRange ) { + NS_DURING + /* + * BIG HACK!!! + */ + if (range.location == 0) {range.location = 1;range.length--;} + [_textStorage addAttributes:aDict range:range]; + NS_HANDLER + NSLog(@"<%@ %x> raised (-colouriseComments):\n%@",[self class],self,[localException description]); + NS_ENDHANDLER + } + } +} + +- (void)colouriseCPPComments +{ + NSRange tmpRange; + BOOL foundRange; + id anObject; + id aDict = [NSDictionary dictionaryWithObjectsAndKeys: + cppCommentColor, NSForegroundColorAttributeName, + @"CommentCodeType", @"PCCodeTypeAttributeName", nil ]; + + [scanner setScanLocation:0]; + + while( ![scanner isAtEnd] ) { + foundRange = NO; + + while( ![scanner isAtEnd] ) { + [scanner scanUpToString:@"//" intoString:NULL]; + range.location = SCANLOC; + [scanner scanString:@"//" intoString:NULL]; + + if( ![scanner isAtEnd] && + [[_textStorage attribute:@"PCCodeTypeAttributeName" + atIndex:range.location + effectiveRange:&tmpRange] isEqual:@"UnknownCodeType"]){ + foundRange = YES; + break; + } + } + + [scanner scanUpToString:@"\n" intoString:NULL]; + [scanner scanString:@"\n" intoString:NULL]; + range.length = SCANLOC - range.location; + + if( foundRange ) { + NS_DURING + [_textStorage addAttributes:aDict range:range]; + NS_HANDLER + NSLog(@"<%@ %x> raised (-colouriseCPPComments):\n%@",[self class],self,[localException description]); + NS_ENDHANDLER + } + } +} + +- (void)colouriseKeyword:(NSString *)keyword +{ + NSRange tmpRange; + BOOL foundRange; + id anObject; + + id keywordDict = [NSDictionary dictionaryWithObjectsAndKeys: + keywordColor,NSForegroundColorAttributeName, + @"KeywordCodeType", @"PCCodeTypeAttributeName", nil ]; + + // First scan for docu style comments + [scanner setScanLocation:0]; + + while( ![scanner isAtEnd] ) { + + [scanner scanUpToString:keyword intoString:NULL]; + range.location = SCANLOC; + + if( ![scanner isAtEnd] && + [[_textStorage attribute:@"PCCodeTypeAttributeName" + atIndex:range.location + effectiveRange:&tmpRange] isEqual:@"UnknownCodeType"] ) { + NS_DURING + [_textStorage addAttributes:keywordDict range:NSMakeRange( range.location, [keyword length])]; + NS_HANDLER + NSLog(@"<%@ %x> raised (-colouriseKeyword:):\n%@",[self class],self,[localException description]); + NS_ENDHANDLER + } + [scanner scanString:keyword intoString:NULL]; + } +} + +- (void)colouriseKeywords:(NSArray *)keywords +{ + NSEnumerator *enumerator = [keywords objectEnumerator]; + id object; + + while ((object = [enumerator nextObject])) { + [self colouriseKeyword:object]; + } +} + +@end + + + + diff --git a/PCLib/PCFileManager.h b/PCLib/PCFileManager.h index 08f61b0..66ea2ec 100644 --- a/PCLib/PCFileManager.h +++ b/PCLib/PCFileManager.h @@ -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 + + + diff --git a/PCLib/PCFileManager.m b/PCLib/PCFileManager.m index 7a9df44..f56c6fe 100644 --- a/PCLib/PCFileManager.m +++ b/PCLib/PCFileManager.m @@ -68,7 +68,7 @@ [box setFrame:NSMakeRect(16,96,224,56)]; fileTypePopup = [[[NSPopUpButton alloc] initWithFrame:NSMakeRect(32,2,160,20) pullsDown:NO] autorelease]; - [fileTypePopup addItemWithTitle:@"No type available!"]; + //[fileTypePopup addItemWithTitle:@"No type available!"]; [fileTypePopup setAutoresizingMask: (NSViewWidthSizable)]; [box setTitle:@"Type"]; [box setTitlePosition:NSAtTop]; @@ -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]; } } } @@ -309,9 +327,11 @@ if (delegate) { path = [delegate fileManager:self willCreateFile:fileName withKey:key]; } - + +#ifdef DEBUG NSLog(@"<%@ %x>: creating file at %@",[self class],self,path); - +#endif DEBUG + // Create file if (path) { NSDictionary *newFiles; @@ -344,9 +364,11 @@ { NSEnumerator *enumerator = [dict keyEnumerator]; id type; - + +#ifdef DEBUG NSLog(@"<%@ %x>: Registering creators...",[self class],self); - +#endif DEBUG + while (type = [enumerator nextObject]) { id creator = [[dict objectForKey:type] objectForKey:@"Creator"]; @@ -367,3 +389,6 @@ } @end + + + diff --git a/PCLib/PCProject.h b/PCLib/PCProject.h index b13eb6c..dd162ba 100644 --- a/PCLib/PCProject.h +++ b/PCLib/PCProject.h @@ -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,16 +59,9 @@ typedef int PCProjInfoBits; -typedef enum { - defaultTarget = 0, - debug, - profile, - install -} btarget; - -//=========================================================================================== +//============================================================================= // ==== Project keys -//=========================================================================================== +//============================================================================= static NSString * const PCClasses = @"CLASS_FILES"; static NSString * const PCHeaders = @"HEADER_FILES"; @@ -72,56 +78,69 @@ static NSString * const PCProjectName = @"PROJECT_NAME"; static NSString * const PCProjType = @"PROJECT_TYPE"; static NSString * const PCPrincipalClass = @"PRINCIPAL_CLASS"; static NSString * const PCAppIcon = @"APPLICATIONICON"; +static NSString * const PCAppClass = @"APPCLASS"; static NSString * const PCToolIcon = @"TOOLICON"; static NSString * const PCProjectBuilderClass = @"PROJECT_BUILDER"; static NSString * const PCMainGModelFile = @"MAININTERFACE"; static NSString * const PCPackageName = @"PACKAGE_NAME"; static NSString * const PCLibraryVar = @"LIBRARY_VAR"; +@class PCProjectBuilder; +@class PCProjectDebugger; + @interface PCProject : NSObject { id projectWindow; id delegate; - id projectBuilder; + id projectManager; id browserController; - id textView; + PCProjectBuilder *projectBuilder; + PCProjectDebugger *projectDebugger; + NSBox *box; id projectAttributeInspectorView; + NSTextField *installPathField; + NSTextField *toolField; + NSTextField *ccOptField; + NSTextField *ldOptField; + id projectProjectInspectorView; + NSTextField *projectTypeField; + id projectFileInspectorView; + NSTextField *fileNameField; + NSButton *changeFileNameButton; id buildTargetPanel; - id buildTargetPopup; + id buildTargetHostField; + id buildTargetArgsField; - id buildStatusField; - id targetField; - NSString *projectName; NSString *projectPath; NSMutableDictionary *projectDict; - NSDictionary *rootCategories; // Needs to be initialised by subclasses! - - @private - BOOL _needsReleasing; - btarget _buildTarget; + NSDictionary *rootCategories; // Needs to be initialised by subclasses! + NSMutableDictionary *buildOptions; } -//=========================================================================================== +//============================================================================= // ==== Init and free -//=========================================================================================== +//============================================================================= - (id)init; - (id)initWithProjectDictionary:(NSDictionary *)dict path:(NSString *)path; - (void)dealloc; -//=========================================================================================== +//============================================================================= // ==== Accessor methods -//=========================================================================================== +//============================================================================= - (id)browserController; +- (NSString *)selectedRootCategory; + +- (NSArray *)fileExtensionsForCategory:(NSString *)key; - (void)setProjectName:(NSString *)aName; - (NSString *)projectName; @@ -129,9 +148,9 @@ static NSString * const PCLibraryVar = @"LIBRARY_VAR"; - (Class)principalClass; -//=========================================================================================== +//============================================================================= // ==== Delegate and manager -//=========================================================================================== +//============================================================================= - (id)delegate; - (void)setDelegate:(id)aDelegate; @@ -139,9 +158,9 @@ static NSString * const PCLibraryVar = @"LIBRARY_VAR"; - (void)setProjectBuilder:(id)aBuilder; - (id)projectBuilder; -//=========================================================================================== +//============================================================================= // ==== To be overriden! -//=========================================================================================== +//============================================================================= - (BOOL)writeMakefile; // Writes the PC.project file to disc. Subclasses need to call this before doing sth else! @@ -156,18 +175,24 @@ static NSString * const PCLibraryVar = @"LIBRARY_VAR"; - (NSString *)projectDescription; // Returns a string describing the project type -- (id)textView; +- (BOOL)isExecutable; + // Returns NO by default. -//=========================================================================================== -// ==== Miscellaneous -//=========================================================================================== +//============================================================================= +// ==== File Handling +//============================================================================= + +- (void)browserDidSelectFileNamed:(NSString *)fileName; - (BOOL)doesAcceptFile:(NSString *)file forKey:(NSString *)key; // Returns YES if type is a valid key and file is not contained in the project already - (void)addFile:(NSString *)file forKey:(NSString *)key; +- (void)addFile:(NSString *)file forKey:(NSString *)key copy:(BOOL)yn; + - (void)removeFile:(NSString *)file forKey:(NSString *)key; - (BOOL)removeSelectedFilePermanently:(BOOL)yn; +- (void)renameFile:(NSString *)aFile; - (BOOL)assignProjectDict:(NSDictionary *)aDict; - (NSDictionary *)projectDict; @@ -185,6 +210,10 @@ static NSString * const PCLibraryVar = @"LIBRARY_VAR"; - (BOOL)saveAllFilesIfNeeded; // Saves all the files that need to be saved. +//============================================================================= +// ==== Subprojects +//============================================================================= + - (NSArray *)subprojects; - (void)addSubproject:(PCProject *)aSubproject; - (PCProject *)superProject; @@ -194,22 +223,31 @@ static NSString * const PCLibraryVar = @"LIBRARY_VAR"; - (BOOL)isSubProject; +//============================================================================= +// ==== Project Handling +//============================================================================= + +- (void)updateValuesFromProjectDict; + @end @interface PCProject (ProjectBuilding) +- (void)topButtonsPressed:(id)sender; +- (void)showBuildView:(id)sender; +- (void)showRunView:(id)sender; + - (void)showInspector:(id)sender; + - (id)updatedAttributeView; - (id)updatedProjectView; - (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 diff --git a/PCLib/PCProject.m b/PCLib/PCProject.m index 15d5e9e..74cd3ce 100644 --- a/PCLib/PCProject.m +++ b/PCLib/PCProject.m @@ -46,8 +46,6 @@ unsigned int style = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask; NSBrowser *browser; - NSSplitView *split; - NSScrollView * scrollView; NSRect _w_frame; NSMatrix* matrix; NSButtonCell* buttonCell = [[[NSButtonCell alloc] init] autorelease]; @@ -61,198 +59,128 @@ * */ - _w_frame = NSMakeRect(100,100,512,320); + _w_frame = NSMakeRect(100,100,560,440); projectWindow = [[NSWindow alloc] initWithContentRect:_w_frame styleMask:style backing:NSBackingStoreBuffered - defer:NO]; + defer:YES]; [projectWindow setDelegate:self]; - [projectWindow setMinSize:NSMakeSize(512,320)]; + [projectWindow setMinSize:NSMakeSize(560,448)]; - browser = [[[NSBrowser alloc] initWithFrame:NSMakeRect(30,30,280,400)] autorelease]; + browser = [[NSBrowser alloc] initWithFrame:NSMakeRect(8,251,544,128)]; [browser setDelegate:browserController]; [browser setMaxVisibleColumns:3]; [browser setAllowsMultipleSelection:NO]; + [browser setAutoresizingMask: NSViewWidthSizable | NSViewMinYMargin]; [browserController setBrowser:browser]; [browserController setProject:self]; + [browser autorelease]; - textView = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,472,88)]; - [textView setMaxSize:NSMakeSize(1e7, 1e7)]; - [textView setVerticallyResizable:YES]; - [textView setHorizontallyResizable:YES]; - [textView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; - [textView setBackgroundColor:[NSColor whiteColor]]; - [[textView textContainer] setWidthTracksTextView:YES]; + box = [[NSBox alloc] initWithFrame:NSMakeRect (0,-1,560,252)]; + [box setTitlePosition:NSNoTitle]; + [box setBorderType:NSNoBorder]; + [box setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; - scrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect (0,0,496,92)]; - [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]; + textField = [[NSTextField alloc] initWithFrame:NSMakeRect(16,200,500,21)]; + [textField setAlignment: NSLeftTextAlignment]; + [textField setBordered: NO]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"Welcome to the GNUstep ProjectCenter!"]; + [box addSubview:[textField autorelease]]; - split = [[[NSSplitView alloc] initWithFrame:NSMakeRect(8,0,496,264)] autorelease]; - [split setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)]; - [split addSubview: browser]; - [split addSubview: scrollView]; + textField = [[NSTextField alloc] initWithFrame:NSMakeRect(16,178,500,21)]; + [textField setAlignment: NSLeftTextAlignment]; + [textField setBordered: NO]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"\tPlease report all bugs or other issues you don't like to phr@projectcenter.ch!"]; + [box addSubview:[textField autorelease]]; _c_view = [projectWindow contentView]; - [_c_view addSubview:split]; + [_c_view addSubview:browser]; + [_c_view addSubview:box]; - // Left button matrix - _w_frame = NSMakeRect(8,268,144,48); + /* + * Left button matrix + */ + + _w_frame = NSMakeRect(8,388,330,48); matrix = [[[NSMatrix alloc] initWithFrame: _w_frame mode: NSHighlightModeMatrix prototype: buttonCell numberOfRows: 1 - numberOfColumns: 3] autorelease]; + numberOfColumns: 7] autorelease]; + [matrix sizeToCells]; + [matrix setTarget:self]; + [matrix setAction:@selector(topButtonsPressed:)]; [matrix setSelectionByRect:YES]; [matrix setAutoresizingMask: (NSViewMaxXMargin | NSViewMinYMargin)]; [_c_view addSubview:matrix]; button = [matrix cellAtRow:0 column:0]; + [button setTag:0]; [button setImagePosition:NSImageOnly]; - [button setImage:[[[NSImage alloc] initWithContentsOfFile:@"ProjectCentre_build.tiff"] autorelease]]; - [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 setButtonType:NSMomentaryPushButton]; - [button setTarget:self]; - [button setAction:@selector(clean:)]; - - button = [matrix cellAtRow:0 column:2]; - [button setImagePosition:NSImageOnly]; - [button setImage:[[[NSImage alloc] initWithContentsOfFile:@"ProjectCentre_prefs.tiff"] autorelease]]; - [button setTarget:self]; - [button setAction:@selector(showBuildTarget:)]; - [button setButtonType:NSMomentaryPushButton]; - [button setTarget:self]; - [button setAction:@selector(showBuildTargetPanel:)]; - - // Right button matrix - _w_frame = NSMakeRect(304,268,192,48); - matrix = [[[NSMatrix alloc] initWithFrame: _w_frame - mode: NSHighlightModeMatrix - prototype: buttonCell - numberOfRows: 1 - numberOfColumns: 4] autorelease]; - [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_build")]; [button setButtonType:NSMomentaryPushButton]; button = [matrix cellAtRow:0 column:1]; + [button setTag:1]; [button setImagePosition:NSImageOnly]; - [button setImage:[[[NSImage alloc] initWithContentsOfFile:@"ProjectCentre_uml.tiff"] autorelease]]; + [button setImage:IMAGE(@"ProjectCentre_settings.tiff")]; [button setButtonType:NSMomentaryPushButton]; button = [matrix cellAtRow:0 column:2]; + [button setTag:2]; [button setImagePosition:NSImageOnly]; - [button setImage:[[[NSImage alloc] initWithContentsOfFile:@"ProjectCentre_documentation.tiff"] autorelease]]; + [button setImage:IMAGE(@"ProjectCentre_prefs.tiff")]; [button setButtonType:NSMomentaryPushButton]; button = [matrix cellAtRow:0 column:3]; + [button setTag:3]; [button setImagePosition:NSImageOnly]; - [button setImage:[[[NSImage alloc] initWithContentsOfFile:@"ProjectCentre_find.tiff"] autorelease]]; + [button setImage:IMAGE(@"ProjectCentre_run.tiff")]; [button setButtonType:NSMomentaryPushButton]; - // Status - textField = [[NSTextField alloc] initWithFrame:NSMakeRect(152,296,48,15)]; - [textField setAlignment: NSRightTextAlignment]; - [textField setBordered: NO]; - [textField setEditable: NO]; - [textField setBezeled: NO]; - [textField setDrawsBackground: NO]; - [textField setStringValue:@"Status:"]; - [textField setAutoresizingMask: (NSViewMaxXMargin | - NSViewMinYMargin)]; - [_c_view addSubview:[textField autorelease]]; + button = [matrix cellAtRow:0 column:4]; + [button setTag:4]; + [button setImagePosition:NSImageOnly]; + [button setImage:IMAGE(@"ProjectCentre_uml.tiff")]; + [button setButtonType:NSMomentaryPushButton]; - // Status message - buildStatusField = [[NSTextField alloc] initWithFrame:NSMakeRect(204,296,104,15)]; - [buildStatusField setAlignment: NSLeftTextAlignment]; - [buildStatusField setBordered: NO]; - [buildStatusField setEditable: NO]; - [buildStatusField setBezeled: NO]; - [buildStatusField setDrawsBackground: NO]; - [buildStatusField setStringValue:@"waiting..."]; - [buildStatusField setAutoresizingMask: (NSViewMaxXMargin | - NSViewWidthSizable | - NSViewMinYMargin)]; - [_c_view addSubview:[buildStatusField autorelease]]; + button = [matrix cellAtRow:0 column:5]; + [button setTag:5]; + [button setImagePosition:NSImageOnly]; + [button setImage:IMAGE(@"ProjectCentre_documentation.tiff")]; + [button setButtonType:NSMomentaryPushButton]; - // Target - textField = [[NSTextField alloc] initWithFrame:NSMakeRect(152,272,48,15)]; - [textField setAlignment: NSRightTextAlignment]; - [textField setBordered: NO]; - [textField setBezeled: NO]; - [textField setEditable: NO]; - [textField setDrawsBackground: NO]; - [textField setStringValue:@"Target:"]; - [textField setAutoresizingMask: (NSViewMaxXMargin | - NSViewMinYMargin)]; - [_c_view addSubview:[textField autorelease]]; - - // Target message - targetField = [[NSTextField alloc] initWithFrame:NSMakeRect(204,272,104,15)]; - [targetField setAlignment: NSLeftTextAlignment]; - [targetField setBordered: NO]; - [targetField setEditable: NO]; - [targetField setBezeled: NO]; - [targetField setDrawsBackground: NO]; - [targetField setStringValue:@"Default..."]; - [targetField setAutoresizingMask: (NSViewMaxXMargin | - NSViewWidthSizable | - NSViewMinYMargin)]; - [_c_view addSubview:[targetField autorelease]]; + button = [matrix cellAtRow:0 column:6]; + [button setTag:6]; + [button setImagePosition:NSImageOnly]; + [button setImage:IMAGE(@"ProjectCentre_find.tiff")]; + [button setButtonType:NSMomentaryPushButton]; /* - * Build Panel + * Build Options Panel * */ - _w_frame = NSMakeRect(100,100,272,104); - buildTargetPanel = [[NSWindow alloc] initWithContentRect:_w_frame styleMask:style backing:NSBackingStoreBuffered defer:NO]; - + _w_frame = NSMakeRect(100,100,272,80); + style = NSTitledWindowMask | NSClosableWindowMask; + buildTargetPanel = [[NSWindow alloc] initWithContentRect:_w_frame + styleMask:style + backing:NSBackingStoreBuffered + defer:YES]; + [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 +190,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 +213,166 @@ [_c_view addSubview:[textField autorelease]]; // Args message - textField = [[NSTextField alloc] initWithFrame:NSMakeRect(72,68,184,21)]; - [textField setAlignment: NSLeftTextAlignment]; + 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]]; + + /* + * Model the standard inspector UI + * + */ + + projectAttributeInspectorView = [[NSBox alloc] init]; + [projectAttributeInspectorView setFrame:NSMakeRect(-2,-2,284,334)]; + [projectAttributeInspectorView setTitlePosition:NSNoTitle]; + [projectAttributeInspectorView setBorderType:NSNoBorder]; + [projectAttributeInspectorView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; + + textField =[[NSTextField alloc] initWithFrame:NSMakeRect(16,280,64,21)]; + [textField setAlignment: NSRightTextAlignment]; [textField setBordered: NO]; - [textField setEditable: YES]; - [textField setBezeled: YES]; - [textField setDrawsBackground: YES]; - [textField setStringValue:@""]; - [_c_view addSubview:[textField autorelease]]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"Install in:"]; + [projectAttributeInspectorView addSubview:[textField autorelease]]; + + installPathField =[[NSTextField alloc] initWithFrame:NSMakeRect(84,280,176,21)]; + [installPathField setAlignment: NSLeftTextAlignment]; + [installPathField setBordered: YES]; + [installPathField setEditable: YES]; + [installPathField setBezeled: YES]; + [installPathField setDrawsBackground: YES]; + [installPathField setStringValue:@""]; + [projectAttributeInspectorView addSubview:installPathField]; + + textField =[[NSTextField alloc] initWithFrame:NSMakeRect(16,256,64,21)]; + [textField setAlignment: NSRightTextAlignment]; + [textField setBordered: NO]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"Build tool:"]; + [projectAttributeInspectorView addSubview:[textField autorelease]]; + + toolField =[[NSTextField alloc] initWithFrame:NSMakeRect(84,256,176,21)]; + [toolField setAlignment: NSLeftTextAlignment]; + [toolField setBordered: YES]; + [toolField setEditable: YES]; + [toolField setBezeled: YES]; + [toolField setDrawsBackground: YES]; + [toolField setStringValue:@""]; + [projectAttributeInspectorView addSubview:toolField]; + + textField =[[NSTextField alloc] initWithFrame:NSMakeRect(16,232,64,21)]; + [textField setAlignment: NSRightTextAlignment]; + [textField setBordered: NO]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"CC options:"]; + [projectAttributeInspectorView addSubview:[textField autorelease]]; + + ccOptField =[[NSTextField alloc] initWithFrame:NSMakeRect(84,232,176,21)]; + [ccOptField setAlignment: NSLeftTextAlignment]; + [ccOptField setBordered: YES]; + [ccOptField setEditable: YES]; + [ccOptField setBezeled: YES]; + [ccOptField setDrawsBackground: YES]; + [ccOptField setStringValue:@""]; + [projectAttributeInspectorView addSubview:ccOptField]; + + textField =[[NSTextField alloc] initWithFrame:NSMakeRect(16,204,64,21)]; + [textField setAlignment: NSRightTextAlignment]; + [textField setBordered: NO]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"LD options:"]; + [projectAttributeInspectorView addSubview:[textField autorelease]]; + + ldOptField =[[NSTextField alloc] initWithFrame:NSMakeRect(84,204,176,21)]; + [ldOptField setAlignment: NSLeftTextAlignment]; + [ldOptField setBordered: YES]; + [ldOptField setEditable: YES]; + [ldOptField setBezeled: YES]; + [ldOptField setDrawsBackground: YES]; + [ldOptField setStringValue:@""]; + [projectAttributeInspectorView addSubview:ldOptField]; + + /* + * Project View + * + */ + + projectProjectInspectorView = [[NSBox alloc] init]; + [projectProjectInspectorView setFrame:NSMakeRect(-2,-2,284,334)]; + [projectProjectInspectorView setTitlePosition:NSNoTitle]; + [projectProjectInspectorView setBorderType:NSNoBorder]; + [projectProjectInspectorView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; + + textField =[[NSTextField alloc] initWithFrame:NSMakeRect(16,280,64,21)]; + [textField setAlignment: NSRightTextAlignment]; + [textField setBordered: NO]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"Type:"]; + [projectProjectInspectorView addSubview:[textField autorelease]]; + + projectTypeField = [[NSTextField alloc] initWithFrame:NSMakeRect(84,280,176,21)]; + [projectTypeField setAlignment: NSLeftTextAlignment]; + [projectTypeField setBordered: NO]; + [projectTypeField setEditable: NO]; + [projectTypeField setBezeled: NO]; + [projectTypeField setDrawsBackground: NO]; + [projectTypeField setStringValue:@""]; + [projectProjectInspectorView addSubview:projectTypeField]; + + projectFileInspectorView = [[NSBox alloc] init]; + [projectFileInspectorView setFrame:NSMakeRect(-2,-2,284,334)]; + [projectFileInspectorView setTitlePosition:NSNoTitle]; + [projectFileInspectorView setBorderType:NSNoBorder]; + [projectFileInspectorView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; + + textField =[[NSTextField alloc] initWithFrame:NSMakeRect(16,280,64,21)]; + [textField setAlignment: NSRightTextAlignment]; + [textField setBordered: NO]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"Filename:"]; + [projectFileInspectorView addSubview:[textField autorelease]]; + + fileNameField =[[NSTextField alloc] initWithFrame:NSMakeRect(84,280,176,21)]; + [fileNameField setAlignment: NSLeftTextAlignment]; + [fileNameField setBordered: NO]; + [fileNameField setEditable: NO]; + [fileNameField setBezeled: NO]; + [fileNameField setDrawsBackground: NO]; + [fileNameField setStringValue:@""]; + [projectFileInspectorView addSubview:fileNameField]; + + changeFileNameButton = [[NSButton alloc] initWithFrame:NSMakeRect(84,240,104,21)]; + [changeFileNameButton setTitle:@"Rename..."]; + [changeFileNameButton setTarget:self]; + [changeFileNameButton setAction:@selector(renameFile:)]; + [projectFileInspectorView addSubview:changeFileNameButton]; + + /* + * + */ // Redisplay! [browser loadColumnZero]; - - _needsReleasing = YES; } @end @@ -308,18 +386,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; } @@ -347,17 +415,31 @@ - (void)dealloc { - [projectName release]; - [projectPath release]; - [projectDict release]; + [projectName release]; + [projectPath release]; + [projectDict release]; + + [browserController release]; + [projectWindow release]; + [buildTargetPanel release]; + + [buildOptions release]; + + [projectAttributeInspectorView release]; + [installPathField release]; + [toolField release]; + [ccOptField release]; + [ldOptField release]; + [projectTypeField release]; - if (_needsReleasing) { - [browserController release]; - [projectWindow release]; - [buildTargetPanel release]; - } + [projectProjectInspectorView release]; + [projectFileInspectorView release]; + [fileNameField release]; + [changeFileNameButton release]; + + [box release]; - [super dealloc]; + [super dealloc]; } //=========================================================================================== @@ -369,6 +451,39 @@ 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 [NSImage imageFileTypes]; + //return [NSArray arrayWithObjects:@"tiff",@"TIFF",@"jpg",@"JPG",@"jpeg",@"JPEG",@"bmp",@"BMP",nil]; + } + + return nil; +} + - (void)setProjectName:(NSString *)aName { [projectName autorelease]; @@ -398,23 +513,23 @@ - (id)delegate { - return delegate; + return delegate; } - (void)setDelegate:(id)aDelegate { - delegate = aDelegate; + delegate = aDelegate; } - (void)setProjectBuilder:(id)aBuilder { - [projectBuilder autorelease]; - projectBuilder = [aBuilder retain]; + [projectManager autorelease]; + projectManager = [aBuilder retain]; } - (id)projectBuilder { - return projectBuilder; + return projectManager; } //=========================================================================================== @@ -456,14 +571,19 @@ return @"Abstract PCProject class!"; } -- (id)textView +- (BOOL)isExecutable { - return textView; + return NO; } -//=========================================================================================== -// ==== Miscellaneous -//=========================================================================================== +//============================================================================= +// ==== File Handling +//============================================================================= + +- (void)browserDidSelectFileNamed:(NSString *)fileName +{ + [fileNameField setStringValue:fileName]; +} - (BOOL)doesAcceptFile:(NSString *)file forKey:(NSString *)type { @@ -480,27 +600,43 @@ - (void)addFile:(NSString *)file forKey:(NSString *)type { - NSMutableArray *files = [NSMutableArray arrayWithArray:[projectDict objectForKey:type]]; - NSMutableString *newFile = [NSMutableString stringWithString:[file lastPathComponent]]; + [self addFile:file forKey:type copy:NO]; +} - if ([type isEqualToString:PCLibraries]) { - [newFile deleteCharactersInRange:NSMakeRange(0,3)]; - newFile = [newFile stringByDeletingPathExtension]; - } - - if ([files containsObject:newFile]) { - NSRunAlertPanel(@"Attention!",@"The file %@ is already contained in this project!",@"OK",nil,nil,newFile); - return; - } - - NSLog(@"<%@ %x>: adding file %@ for key %@",[self class],self,newFile,type); +- (void)addFile:(NSString *)file forKey:(NSString *)type copy:(BOOL)yn +{ + NSMutableArray *files = [NSMutableArray arrayWithArray:[projectDict objectForKey:type]]; + NSMutableString *newFile = [NSMutableString stringWithString:[file lastPathComponent]]; + + if ([type isEqualToString:PCLibraries]) { + [newFile deleteCharactersInRange:NSMakeRange(0,3)]; + newFile = [newFile stringByDeletingPathExtension]; + } + + if ([files containsObject:newFile]) { + NSRunAlertPanel(@"Attention!",@"The file %@ is already part of this project!",@"OK",nil,nil,newFile); + return; + } + +#ifdef DEBUG + NSLog(@"<%@ %x>: adding file %@ for key %@",[self class],self,newFile,type); +#endif DEBUG + + // Add the new file + [files addObject:newFile]; + [projectDict setObject:files forKey:type]; + + // Synchronise the makefile! + [self writeMakefile]; + + if (yn) { + NSFileManager *manager = [NSFileManager defaultManager]; + NSString *destination = [[self projectPath] stringByAppendingPathComponent:newFile]; - // Add the new file - [files addObject:newFile]; - [projectDict setObject:files forKey:type]; - - // Synchronise the makefile! - [self writeMakefile]; + if (![manager copyPath:file toPath:destination handler:nil]) { + NSRunAlertPanel(@"Attention!",@"The file %@ could not be copied to %@!",@"OK",nil,nil,newFile,destination); + } + } } - (void)removeFile:(NSString *)file forKey:(NSString *)key @@ -522,6 +658,10 @@ NSString *file = [browserController nameOfSelectedFile]; NSMutableArray *array; NSString *key; + NSString *otherKey; + NSString *ext; + NSString *fn; + BOOL ret = NO; if (!file) { return NO; @@ -530,16 +670,52 @@ 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; } +- (void)renameFile:(NSString *)aFile +{ +} + - (BOOL)assignProjectDict:(NSDictionary *)aDict { NSAssert(aDict,@"No valid project dictionary!"); @@ -552,11 +728,11 @@ projectDict = [[NSMutableDictionary alloc] initWithDictionary:aDict]; [self setProjectName:[projectDict objectForKey:PCProjectName]]; - [projectWindow setTitle:[NSString stringWithFormat:@"%@ - %@",projectName,projectPath]]; - // Update the GNUmakefile! + // Update the GNUmakefile and the interface [self writeMakefile]; + [self updateValuesFromProjectDict]; [[NSNotificationCenter defaultCenter] postNotificationName:@"ProjectDictDidChangeNotification" object:self]; @@ -604,6 +780,10 @@ { } +//============================================================================= +// ==== Subprojects +//============================================================================= + - (NSArray *)subprojects { return [projectDict objectForKey:PCSubprojects]; @@ -633,15 +813,83 @@ - (BOOL)isSubProject { + return NO; +} + +//============================================================================= +// ==== Project Handling +//============================================================================= + +- (void)updateValuesFromProjectDict +{ + [projectTypeField setStringValue:[projectDict objectForKey:PCProjType]]; } @end @implementation PCProject (ProjectBuilding) +- (void)topButtonsPressed:(id)sender +{ + switch ([[sender selectedCell] tag]) { + case 0: + [self showBuildView:self]; + break; + case 1: + [self showInspector:self]; + break; + case 2: + [self showBuildTargetPanel:self]; + break; + case 3: + if ([self isExecutable]) { + [self showRunView:self]; + } + else { + NSRunAlertPanel(@"Attention!",@"This project type cannot be executed by itself!",@"OK",nil,nil); + } + break; + case 4: + case 5: + case 6: + NSRunAlertPanel(@"Help!",@"This feature is not yet implemented! Please contact me if you are interested in volunteering.",@"Of course!",nil,nil); + break; + default: + break; + } +} + +- (void)showBuildView:(id)sender +{ + NSView *view = nil; + + if (!projectBuilder) { + projectBuilder = [[PCProjectBuilder alloc] initWithProject:self]; + } + + view = [[projectBuilder componentView] retain]; + + [box setContentView:view]; + [box display]; +} + +- (void)showRunView:(id)sender +{ + NSView *view = nil; + + if (!projectDebugger) { + projectDebugger = [[PCProjectDebugger alloc] initWithProject:self]; + } + + view = [[projectDebugger componentView] retain]; + + [box setContentView:view]; + [box display]; +} + - (void)showInspector:(id)sender { - [projectBuilder showInspectorForProject:self]; + [projectManager showInspectorForProject:self]; } - (id)updatedAttributeView @@ -661,74 +909,27 @@ - (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]; } - (void)setArguments:(id)sender { - NSLog(@"Setting args..."); + NSString *args = [buildTargetArgsField stringValue]; + [buildOptions setObject:args forKey:BUILD_ARGS_KEY]; } -- (void)build:(id)sender +- (NSDictionary *)buildOptions { - 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!"]; - } -} - -- (void)clean:(id)sender -{ - 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 @@ -739,7 +940,9 @@ { NSString *key; +#ifdef DEBUG NSLog(@"<%@ %x>: content at path %@",[self class],self,keyPath); +#endif if ([keyPath isEqualToString:@""] || [keyPath isEqualToString:@"/"]) { return [rootCategories allKeys]; @@ -758,7 +961,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 +971,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 +982,30 @@ - (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 diff --git a/PCLib/PCProjectBuilder.h b/PCLib/PCProjectBuilder.h index 3ad3c7c..4aa3a20 100644 --- a/PCLib/PCProjectBuilder.h +++ b/PCLib/PCProjectBuilder.h @@ -24,37 +24,51 @@ $Id$ */ -#import +#import @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; - @interface PCProjectBuilder : NSObject { - NSWindow *buildWindow; + NSBox *componentView; NSTextView *logOutput; + NSTextView *errorOutput; - NSMutableDictionary *buildTasks; NSString *makePath; + + id buildStatusField; + id targetField; + + PCProject *currentProject; + NSDictionary *currentOptions; + + NSFileHandle *readHandle; + NSFileHandle *errorReadHandle; } -+ (id)sharedBuilder; - -- (id)init; +- (id)initWithProject:(PCProject *)aProject; - (void)dealloc; -- (BOOL)buildProject:(PCProject *)aProject options:(NSDictionary *)optionDict; +- (NSView *)componentView; + +- (void)build:(id)sender; + +- (void)logStdOut:(NSNotification *)aNotif; +- (void)logErrOut:(NSNotification *)aNotif; + +- (void)buildDidTerminate:(NSNotification *)aNotif; @end + +@interface PCProjectBuilder (BuildLogging) + +- (void)logString:(NSString *)string error:(BOOL)yn; +- (void)logString:(NSString *)string error:(BOOL)yn newLine:(BOOL)newLine; +- (void)logData:(NSData *)data error:(BOOL)yn; + +@end + + + + diff --git a/PCLib/PCProjectBuilder.m b/PCLib/PCProjectBuilder.m index 3daed46..133c7f3 100644 --- a/PCLib/PCProjectBuilder.m +++ b/PCLib/PCProjectBuilder.m @@ -26,57 +26,59 @@ #import "PCProjectBuilder.h" #import "PCProject.h" +#import "PCProjectManager.h" #import +#ifndef IMAGE +#define IMAGE(X) [[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:(X)]] autorelease] +#endif + +#ifndef NOTIFICATION_CENTER +#define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter] +#endif + @interface PCProjectBuilder (CreateUI) -- (void)_initUI; +- (void)_createComponentView; @end @implementation PCProjectBuilder (CreateUI) -- (void)_initUI +- (void)_createComponentView { - NSView *_c_view; - unsigned int style = NSTitledWindowMask | NSClosableWindowMask | - NSMiniaturizableWindowMask | NSResizableWindowMask; NSSplitView *split; NSScrollView *scrollView1; - NSScrollView *scrollView2; - NSTextView *textView2; - + NSMatrix* matrix; NSRect _w_frame; + NSButtonCell* buttonCell = [[[NSButtonCell alloc] init] autorelease]; + id button; + id textField; + + componentView = [[NSBox alloc] initWithFrame:NSMakeRect(0,0,544,248)]; + [componentView setTitlePosition:NSNoTitle]; + [componentView setBorderType:NSNoBorder]; + [componentView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; /* - * Build Window - * */ - _w_frame = NSMakeRect(100,100,512,320); - buildWindow = [[NSWindow alloc] initWithContentRect:_w_frame - styleMask:style - backing:NSBackingStoreBuffered - defer:NO]; - [buildWindow setDelegate:self]; - [buildWindow setReleasedWhenClosed:NO]; - [buildWindow setMinSize:NSMakeSize(512,320)]; - - logOutput = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,472,88)]; + logOutput = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,516,32)]; [logOutput setMaxSize:NSMakeSize(1e7, 1e7)]; - [logOutput setVerticallyResizable:YES]; - [logOutput setHorizontallyResizable:YES]; + [logOutput setMinSize:NSMakeSize(516, 48)]; + [logOutput setRichText:NO]; + [logOutput setEditable:NO]; + [logOutput setSelectable:YES]; [logOutput setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; - [logOutput setBackgroundColor:[NSColor whiteColor]]; + [logOutput setBackgroundColor:[NSColor lightGrayColor]]; [[logOutput textContainer] setWidthTracksTextView:YES]; - scrollView1 = [[NSScrollView alloc] initWithFrame:NSMakeRect (0,0,496,92)]; + scrollView1 = [[NSScrollView alloc] initWithFrame:NSMakeRect (0,0,540,46)]; [scrollView1 setDocumentView:logOutput]; - [logOutput setMinSize:NSMakeSize(0.0,[scrollView1 contentSize].height)]; [[logOutput textContainer] setContainerSize:NSMakeSize([scrollView1 contentSize].width,1e7)]; - [scrollView1 setHasHorizontalScroller: YES]; + [scrollView1 setHasHorizontalScroller: NO]; [scrollView1 setHasVerticalScroller: YES]; [scrollView1 setBorderType: NSBezelBorder]; [scrollView1 setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; @@ -86,143 +88,359 @@ * */ - textView2 = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,472,88)]; - [textView2 setMaxSize:NSMakeSize(1e7, 1e7)]; - [textView2 setVerticallyResizable:YES]; - [textView2 setHorizontallyResizable:YES]; - [textView2 setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; - [textView2 setBackgroundColor:[NSColor whiteColor]]; - [[textView2 textContainer] setWidthTracksTextView:YES]; + errorOutput = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,516,80)]; + [errorOutput setMaxSize:NSMakeSize(1e7, 1e7)]; + [errorOutput setMinSize:NSMakeSize(516, 48)]; + [errorOutput setRichText:NO]; + [errorOutput setEditable:NO]; + [errorOutput setSelectable:YES]; + [errorOutput setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; + [errorOutput setBackgroundColor:[NSColor whiteColor]]; + [[errorOutput textContainer] setWidthTracksTextView:YES]; - scrollView2 = [[NSScrollView alloc] initWithFrame:NSMakeRect (0,0,496,92)]; - [scrollView2 setDocumentView:textView2]; - [textView2 setMinSize:NSMakeSize(0.0,[scrollView2 contentSize].height)]; - [[textView2 textContainer] setContainerSize:NSMakeSize([scrollView2 contentSize].width,1e7)]; - [scrollView2 setHasHorizontalScroller: YES]; - [scrollView2 setHasVerticalScroller: YES]; + scrollView2 = [[NSScrollView alloc] initWithFrame:NSMakeRect (0,0,540,92)]; + [scrollView2 setDocumentView:errorOutput]; + [[errorOutput textContainer] setContainerSize:NSMakeSize([scrollView2 contentSize].width,1e7)]; + [scrollView2 setHasHorizontalScroller:NO]; + [scrollView2 setHasVerticalScroller:YES]; [scrollView2 setBorderType: NSBezelBorder]; [scrollView2 setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; [scrollView2 autorelease]; - split = [[[NSSplitView alloc] initWithFrame:NSMakeRect(8,0,496,264)] autorelease]; + split = [[NSSplitView alloc] initWithFrame:NSMakeRect(0,0,540,188)]; [split setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)]; [split addSubview: scrollView1]; [split addSubview: scrollView2]; + [split adjustSubviews]; + + [componentView addSubview:split]; + [split autorelease]; - _c_view = [buildWindow contentView]; - [_c_view addSubview:split]; + /* + * 5 build Buttons + */ + + _w_frame = NSMakeRect(0,194,224,44); + matrix = [[[NSMatrix alloc] initWithFrame: _w_frame + mode: NSHighlightModeMatrix + prototype: buttonCell + numberOfRows: 1 + numberOfColumns: 5] autorelease]; + [matrix sizeToCells]; + [matrix setSelectionByRect:YES]; + [matrix setAutoresizingMask: (NSViewMaxXMargin | NSViewMinYMargin)]; + [matrix setTarget:self]; + [matrix setAction:@selector(build:)]; + [componentView addSubview:matrix]; + + button = [matrix cellAtRow:0 column:0]; + [button setTag:0]; + [button setImagePosition:NSImageOnly]; + [button setImage:IMAGE(@"ProjectCenter_make")]; + [button setButtonType:NSMomentaryPushButton]; + [button setTitle:@"Build"]; + + button = [matrix cellAtRow:0 column:1]; + [button setTag:1]; + [button setImagePosition:NSImageOnly]; + [button setImage:IMAGE(@"ProjectCenter_clean")]; + [button setButtonType:NSMomentaryPushButton]; + [button setTitle:@"Clean"]; + + button = [matrix cellAtRow:0 column:2]; + [button setTag:2]; + [button setImagePosition:NSImageOnly]; + [button setImage:IMAGE(@"ProjectCenter_debug")]; + [button setButtonType:NSMomentaryPushButton]; + [button setTitle:@"Debug"]; + + button = [matrix cellAtRow:0 column:3]; + [button setTag:3]; + [button setImagePosition:NSImageOnly]; + [button setImage:IMAGE(@"ProjectCenter_profile")]; + [button setButtonType:NSMomentaryPushButton]; + [button setTitle:@"Profile"]; + + button = [matrix cellAtRow:0 column:4]; + [button setTag:4]; + [button setImagePosition:NSImageOnly]; + [button setImage:IMAGE(@"ProjectCenter_install")]; + [button setButtonType:NSMomentaryPushButton]; + [button setTitle:@"Install"]; + + /* + * Status + */ + + textField = [[NSTextField alloc] initWithFrame:NSMakeRect(256,220,48,15)]; + [textField setAlignment: NSRightTextAlignment]; + [textField setBordered: NO]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"Status:"]; + [textField setAutoresizingMask: (NSViewMaxXMargin | + NSViewMinYMargin)]; + [componentView addSubview:[textField autorelease]]; + + /* + * Status message + */ + + buildStatusField = [[NSTextField alloc] initWithFrame:NSMakeRect(308,220,104,15)]; + [buildStatusField setAlignment: NSLeftTextAlignment]; + [buildStatusField setBordered: NO]; + [buildStatusField setEditable: NO]; + [buildStatusField setBezeled: NO]; + [buildStatusField setDrawsBackground: NO]; + [buildStatusField setStringValue:@"waiting..."]; + [buildStatusField setAutoresizingMask: (NSViewMaxXMargin | + NSViewWidthSizable | + NSViewMinYMargin)]; + [componentView addSubview:[buildStatusField autorelease]]; + + /* + * Target + */ + + textField = [[NSTextField alloc] initWithFrame:NSMakeRect(256,196,48,15)]; + [textField setAlignment: NSRightTextAlignment]; + [textField setBordered: NO]; + [textField setBezeled: NO]; + [textField setEditable: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"Target:"]; + [textField setAutoresizingMask: (NSViewMaxXMargin | + NSViewMinYMargin)]; + [componentView addSubview:[textField autorelease]]; + + /* + * Target message + */ + + targetField = [[NSTextField alloc] initWithFrame:NSMakeRect(308,196,104,15)]; + [targetField setAlignment: NSLeftTextAlignment]; + [targetField setBordered: NO]; + [targetField setEditable: NO]; + [targetField setBezeled: NO]; + [targetField setDrawsBackground: NO]; + [targetField setStringValue:@"Default..."]; + [targetField setAutoresizingMask: (NSViewMaxXMargin | + NSViewWidthSizable | + NSViewMinYMargin)]; + [componentView addSubview:[targetField autorelease]]; } @end @implementation PCProjectBuilder -static PCProjectBuilder *_builder; - -+ (id)sharedBuilder +- (id)initWithProject:(PCProject *)aProject { - if (!_builder) { - _builder = [[PCProjectBuilder alloc] init]; - } - return _builder; -} + NSAssert(aProject,@"No project specified!"); -- (id)init -{ if ((self = [super init])) { - [self _initUI]; makePath = [[NSString stringWithString:@"/usr/bin/make"] retain]; - buildTasks = [[NSMutableDictionary dictionary] retain]; + currentProject = aProject; } return self; } - (void)dealloc { - [buildWindow release]; + [componentView release]; [makePath release]; - [buildTasks release]; [super dealloc]; } -- (BOOL)buildProject:(PCProject *)aProject options:(NSDictionary *)optionDict +- (NSView *)componentView; +{ + if (!componentView) { + [self _createComponentView]; + } + + return componentView; +} + +- (void)build:(id)sender { - BOOL ret = NO; NSString *tg = nil; NSTask *makeTask; NSMutableArray *args; - NSString *output = nil; NSPipe *logPipe; - NSFileHandle *readHandle; - NSData *inData = nil; + NSPipe *errorPipe; + NSDictionary *optionDict; + NSString *status; + NSString *target; logPipe = [NSPipe pipe]; - readHandle = [logPipe fileHandleForReading]; - - NSAssert(aProject,@"No project provided!"); + readHandle = [[logPipe fileHandleForReading] retain]; + + errorPipe = [NSPipe pipe]; + errorReadHandle = [[errorPipe fileHandleForReading] retain]; 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]; + optionDict = [currentProject buildOptions]; + args = [NSMutableArray array]; + + switch ([[sender selectedCell] tag]) { + case 0: + status = [NSString stringWithString:@"Building..."]; + target = [NSString stringWithString:@"Default"]; + break; + case 1: + if (NSRunAlertPanel(@"Clean Project?",@"Really clean %@?",@"Yes",@"No",nil,[currentProject projectName]) == NSAlertAlternateReturn) { + return; } - 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]; - } - - [makeTask setCurrentDirectoryPath:[aProject projectPath]]; - [makeTask setLaunchPath:makePath]; - - [makeTask setStandardOutput:logPipe]; - [makeTask setStandardError:logPipe]; - - 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]; + status = [NSString stringWithString:@"Cleaning..."]; + target = [NSString stringWithString:@"Clean"]; + [args addObject:@"clean"]; + break; + case 2: + status = [NSString stringWithString:@"Building..."]; + target = [NSString stringWithString:@"Debug"]; + [args addObject:@"debug=yes"]; + break; + case 3: + status = [NSString stringWithString:@"Building..."]; + target = [NSString stringWithString:@"Profile"]; + [args addObject:@"profile=yes"]; + [args addObject:@"static=yes"]; + break; + case 4: + status = [NSString stringWithString:@"Installing..."]; + target = [NSString stringWithString:@"Install"]; + [args addObject:@"install"]; + break; } + + [buildStatusField setStringValue:status]; + [targetField setStringValue:target]; + + [NOTIFICATION_CENTER addObserver:self + selector:@selector(logStdOut:) + name:NSFileHandleDataAvailableNotification + object:readHandle]; - return ret; + [NOTIFICATION_CENTER addObserver:self + selector:@selector(logErrOut:) + name:NSFileHandleDataAvailableNotification + object:errorReadHandle]; + + [NOTIFICATION_CENTER addObserver: self + selector: @selector(buildDidTerminate:) + name: NSTaskDidTerminateNotification + object: makeTask]; + + [makeTask setArguments:args]; + [makeTask setCurrentDirectoryPath:[currentProject projectPath]]; + [makeTask setLaunchPath:makePath]; + + [makeTask setStandardOutput:logPipe]; + [makeTask setStandardError:errorPipe]; + + [logOutput setString:@""]; + [readHandle waitForDataInBackgroundAndNotify]; + + [errorOutput setString:@""]; + [errorReadHandle waitForDataInBackgroundAndNotify]; + + [makeTask launch]; + [makeTask waitUntilExit]; + + [buildStatusField setStringValue:@"Waiting..."]; + [targetField setStringValue:@""]; + + [NOTIFICATION_CENTER removeObserver:self + name:NSFileHandleDataAvailableNotification + object:readHandle]; + + [NOTIFICATION_CENTER removeObserver:self + name:NSFileHandleDataAvailableNotification + object:errorReadHandle]; + + [NOTIFICATION_CENTER removeObserver:self + name:NSTaskDidTerminateNotification + object:makeTask]; + + [readHandle release]; + [errorReadHandle release]; + [makeTask autorelease]; +} + +- (void)logStdOut:(NSNotification *)aNotif +{ + NSData *data; + + if ((data = [readHandle availableData])) { + [self logData:data error:NO]; + } + + [readHandle waitForDataInBackgroundAndNotifyForModes:nil]; +} + +- (void)logErrOut:(NSNotification *)aNotif +{ + NSData *data; + + if ((data = [errorReadHandle availableData])) { + [self logData:data error:YES]; + } + + [errorReadHandle waitForDataInBackgroundAndNotifyForModes:nil]; +} + +- (void)buildDidTerminate:(NSNotification *)aNotif +{ + int status = [[aNotif object] terminationStatus]; + + if (status == 0) { + [self logString:@"*** Build Succeeded!\n" error:NO newLine:YES]; + } + else { + [self logString:@"*** Build Failed!" error:YES newLine:YES]; + [[logOutput window] orderFront:self]; + } } @end + +@implementation PCProjectBuilder (BuildLogging) + +- (void)logString:(NSString *)string error:(BOOL)yn +{ + [self logString:string error:yn newLine:YES]; +} + +- (void)logString:(NSString *)str error:(BOOL)yn newLine:(BOOL)newLine +{ + NSTextView *out = (yn)?errorOutput:logOutput; + + [out replaceCharactersInRange:NSMakeRange([[out string] length],0) withString:str]; + + if (newLine) { + [out replaceCharactersInRange:NSMakeRange([[out string] length], 0) withString:@"\n"]; + } + else { + [out replaceCharactersInRange:NSMakeRange([[out string] length], 0) withString:@" "]; + } + + [out scrollRangeToVisible:NSMakeRange([[out string] length], 0)]; +} + +- (void)logData:(NSData *)data error:(BOOL)yn +{ + NSString *s = [[NSString alloc] initWithData:data + encoding:[NSString defaultCStringEncoding]]; + + [self logString:s error:yn newLine:YES]; + [s autorelease]; +} + +@end + + + + diff --git a/PCLib/PCProjectDebugger.h b/PCLib/PCProjectDebugger.h new file mode 100644 index 0000000..de8e38c --- /dev/null +++ b/PCLib/PCProjectDebugger.h @@ -0,0 +1,44 @@ +/* + GNUstep ProjectCenter - http://www.projectcenter.ch + + Copyright (C) 2000 Philippe C.D. Robert + + Author: Philippe C.D. Robert + + 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 + +@class PCProject; + +@interface PCProjectDebugger : NSObject +{ + NSBox *componentView; + + PCProject *currentProject; + NSDictionary *currentOptions; +} + +- (id)initWithProject:(PCProject *)aProject; +- (void)dealloc; + +- (NSView *)componentView; + +@end diff --git a/PCLib/PCProjectDebugger.m b/PCLib/PCProjectDebugger.m new file mode 100644 index 0000000..517b6ae --- /dev/null +++ b/PCLib/PCProjectDebugger.m @@ -0,0 +1,147 @@ +/* + GNUstep ProjectCenter - http://www.projectcenter.ch + + Copyright (C) 2000 Philippe C.D. Robert + + Author: Philippe C.D. Robert + + 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 "PCProjectDebugger.h" +#import "PCProject.h" +#import "PCProjectManager.h" + +#import + +#ifndef IMAGE +#define IMAGE(X) [[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:(X)]] autorelease] +#endif + +#ifndef NOTIFICATION_CENTER +#define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter] +#endif + +@interface PCProjectDebugger (CreateUI) + +- (void)_createComponentView; + +@end + +@implementation PCProjectDebugger (CreateUI) + +- (void)_createComponentView +{ + NSSplitView *split; + NSScrollView *scrollView1; + NSScrollView *scrollView2; + NSMatrix* matrix; + NSRect _w_frame; + NSButtonCell* buttonCell = [[[NSButtonCell alloc] init] autorelease]; + id button; + id textField; + + componentView = [[NSBox alloc] initWithFrame:NSMakeRect(0,0,544,248)]; + [componentView setTitlePosition:NSNoTitle]; + [componentView setBorderType:NSNoBorder]; + [componentView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; + + /* + */ + + _w_frame = NSMakeRect(0,194,244,44); + matrix = [[[NSMatrix alloc] initWithFrame: _w_frame + mode: NSHighlightModeMatrix + prototype: buttonCell + numberOfRows: 1 + numberOfColumns: 5] autorelease]; + [matrix sizeToCells]; + [matrix setSelectionByRect:YES]; + [matrix setAutoresizingMask: (NSViewMaxXMargin | NSViewMinYMargin)]; + [matrix setTarget:self]; + [matrix setAction:@selector(build:)]; + [componentView addSubview:matrix]; + + button = [matrix cellAtRow:0 column:0]; + [button setTag:0]; + [button setImagePosition:NSImageOnly]; + //[button setImage:IMAGE(@"ProjectCenter_make")]; + [button setButtonType:NSMomentaryPushButton]; + [button setTitle:@"Build"]; + + button = [matrix cellAtRow:0 column:1]; + [button setTag:1]; + [button setImagePosition:NSImageOnly]; + //[button setImage:IMAGE(@"ProjectCenter_clean")]; + [button setButtonType:NSMomentaryPushButton]; + [button setTitle:@"Clean"]; + + button = [matrix cellAtRow:0 column:2]; + [button setTag:2]; + [button setImagePosition:NSImageOnly]; + //[button setImage:IMAGE(@"ProjectCenter_debug")]; + [button setButtonType:NSMomentaryPushButton]; + [button setTitle:@"Debug"]; + + button = [matrix cellAtRow:0 column:3]; + [button setTag:3]; + [button setImagePosition:NSImageOnly]; + //[button setImage:IMAGE(@"ProjectCenter_profile")]; + [button setButtonType:NSMomentaryPushButton]; + [button setTitle:@"Profile"]; + + button = [matrix cellAtRow:0 column:4]; + [button setTag:4]; + [button setImagePosition:NSImageOnly]; + //[button setImage:IMAGE(@"ProjectCenter_install")]; + [button setButtonType:NSMomentaryPushButton]; + [button setTitle:@"Install"]; +} + +@end + +@implementation PCProjectDebugger + +- (id)initWithProject:(PCProject *)aProject +{ + NSAssert(aProject,@"No project specified!"); + + if ((self = [super init])) { + currentProject = aProject; + } + return self; +} + +- (void)dealloc +{ + [componentView release]; + + [super dealloc]; +} + +- (NSView *)componentView; +{ + if (!componentView) { + [self _createComponentView]; + } + + return componentView; +} + +@end diff --git a/PCLib/PCProjectManager.h b/PCLib/PCProjectManager.h index 3e1aa23..d0ebd73 100644 --- a/PCLib/PCProjectManager.h +++ b/PCLib/PCProjectManager.h @@ -131,8 +131,7 @@ // =========================================================================== - (BOOL)openFile:(NSString *)path; -- (BOOL)addFile:(NSString *)path; -- (BOOL)newFile:(NSString *)path; + - (BOOL)saveFile; - (BOOL)saveFileAs:(NSString *)path; - (BOOL)revertFile; @@ -167,3 +166,7 @@ - (BOOL)projectManager:(id)sender shouldOpenProject:(PCProject *)aProject; @end + +extern NSString *ActiveProjectDidChangeNotification; + + diff --git a/PCLib/PCProjectManager.m b/PCLib/PCProjectManager.m index 6e3278a..ff542fc 100644 --- a/PCLib/PCProjectManager.m +++ b/PCLib/PCProjectManager.m @@ -31,6 +31,8 @@ #import #endif +NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange"; + @interface PCProjectManager (CreateUI) - (void)_initUI; @@ -42,8 +44,7 @@ - (void)_initUI { NSView *_c_view; - unsigned int style = NSTitledWindowMask | NSClosableWindowMask | - NSResizableWindowMask; + unsigned int style = NSTitledWindowMask | NSClosableWindowMask; NSRect _w_frame; NSBox *line; @@ -59,9 +60,12 @@ defer:NO]; [inspector setMinSize:NSMakeSize(280,384)]; [inspector setTitle:@"Inspector"]; + [inspector setReleasedWhenClosed:NO]; + [inspector setFrameAutosaveName:@"Inspector"]; _c_view = [inspector contentView]; - inspectorPopup = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(80,352,128,20)]; + _w_frame = NSMakeRect(80,352,128,20); + inspectorPopup = [[NSPopUpButton alloc] initWithFrame:_w_frame]; [inspectorPopup addItemWithTitle:@"None"]; [inspectorPopup setTarget:self]; [inspectorPopup setAction:@selector(inspectorPopupDidChange:)]; @@ -69,12 +73,12 @@ line = [[[NSBox alloc] init] autorelease]; [line setTitlePosition:NSNoTitle]; - [line setFrameFromContentFrame:NSMakeRect(0,336,280,2)]; + [line setFrame:NSMakeRect(0,336,280,2)]; [_c_view addSubview:line]; inspectorView = [[NSBox alloc] init]; [inspectorView setTitlePosition:NSNoTitle]; - [inspectorView setFrameFromContentFrame:NSMakeRect(2,2,276,330)]; + [inspectorView setFrame:NSMakeRect(-2,-2,284,334)]; [inspectorView setBorderType:NSNoBorder]; [_c_view addSubview:inspectorView]; @@ -155,18 +159,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 +204,8 @@ concretBuilder = [NSClassFromString([builders objectForKey:builderKey]) sharedCreator]; if ((project = [concretBuilder openProjectAt:aPath])) { + [[project projectWindow] center]; + return project; } } @@ -250,6 +258,8 @@ return NO; } + [[project projectWindow] center]; + [project setProjectBuilder:self]; [loadedProjects setObject:project forKey:aPath]; [self setActiveProject:project]; @@ -271,38 +281,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"]; @@ -311,6 +314,10 @@ } [self inspectorPopupDidChange:inspectorPopup]; + + if (![inspector isVisible]) { + [inspector setFrameUsingName:@"Inspector"]; + } [inspector makeKeyAndOrderFront:self]; } @@ -340,23 +347,23 @@ - (void)closeProject:(PCProject *)aProject { - PCProject *currentProject; - NSString *key = [[aProject projectPath] stringByAppendingPathComponent:@"PC.project"]; - - currentProject = [[loadedProjects objectForKey:key] retain]; + PCProject *currentProject; + NSString *key = [[aProject projectPath] stringByAppendingPathComponent:@"PC.project"]; + + currentProject = [[loadedProjects objectForKey:key] retain]; - // Remove it from the loaded projects! - [loadedProjects removeObjectForKey:key]; - [self setActiveProject:[[loadedProjects allValues] lastObject]]; + // Remove it from the loaded projects! + [loadedProjects removeObjectForKey:key]; + [self setActiveProject:[[loadedProjects allValues] lastObject]]; - [currentProject autorelease]; - - //~ Should I activate another project here?! + [currentProject autorelease]; + + //~ Should I activate another project here?! } - (void)closeProject { - [[[self activeProject] projectWindow] performClose:self]; + [[[self activeProject] projectWindow] performClose:self]; } // =========================================================================== @@ -365,20 +372,18 @@ - (BOOL)openFile:(NSString *)path { - id editor = [[[delegate prefController] preferencesDict] objectForKey:Editor]; + BOOL isDir; + NSFileManager *fm = [NSFileManager defaultManager]; + NSDictionary *ui =[NSDictionary dictionaryWithObjectsAndKeys: + path,@"FilePathKey", + nil]; - if (!editor) { - } + if ([fm fileExistsAtPath:path isDirectory:&isDir] && !isDir) { + [[NSNotificationCenter defaultCenter] postNotificationName:FileShouldOpenNotification object:self userInfo:ui]; + return YES; + } - [editor openFile:path]; -} - -- (BOOL)addFile:(NSString *)path -{ -} - -- (BOOL)newFile:(NSString *)path -{ + return NO; } - (BOOL)saveFile @@ -425,7 +430,10 @@ - (void)fileManager:(id)sender didCreateFile:(NSString *)aFile withKey:(NSString *)key { +#ifdef DEBUG NSLog(@"<%@ %x>: did create file %@ for key %@",[self class],self,aFile,key); +#endif DEBUG + [activeProject addFile:aFile forKey:key]; } @@ -438,7 +446,9 @@ { NSMutableString *fn = [NSMutableString stringWithString:[file lastPathComponent]]; +#ifdef DEBUG NSLog(@"<%@ %x>: should add file %@ for key %@",[self class],self,file,key); +#endif DEBUG if ([key isEqualToString:PCLibraries]) { [fn deleteCharactersInRange:NSMakeRange(1,3)]; @@ -454,9 +464,14 @@ - (void)fileManager:(id)sender didAddFile:(NSString *)file forKey:(NSString *)key { +#ifdef DEBUG NSLog(@"<%@ %x>: did add file %@ for key %@",[self class],self,file,key); +#endif DEBUG + [activeProject addFile:file forKey:key]; } @end + + diff --git a/PCLib/PCServer.h b/PCLib/PCServer.h index e7e3864..102d167 100644 --- a/PCLib/PCServer.h +++ b/PCLib/PCServer.h @@ -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 { NSMutableArray *clients; + NSMutableDictionary *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; diff --git a/PCLib/PCServer.m b/PCLib/PCServer.m index 33eb332..1119e00 100644 --- a/PCLib/PCServer.m +++ b/PCLib/PCServer.m @@ -26,23 +26,143 @@ #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 = [[NSMutableDictionary 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 +{ + if ([openDocuments objectForKey:file]) { + [[openDocuments objectForKey:file] makeKeyAndOrderFront:self]; + } + else { + NSWindow *editorWindow = [self editorForFile:file]; + + [editorWindow setDelegate:self]; + [editorWindow center]; + [editorWindow makeKeyAndOrderFront:self]; + + [openDocuments setObject:editorWindow forKey:file]; + } +} + +- (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:YES]; + PCEditorView *textView; + NSScrollView *scrollView; + + NSString *text = [NSString stringWithContentsOfFile:aFile]; + + [window setMinSize:NSMakeSize(512,320)]; + [window setTitle:aFile]; + + textView = [[PCEditorView alloc] initWithFrame:NSMakeRect(0,0,498,306)]; + [textView setMaxSize:NSMakeSize(1e7, 1e7)]; + [textView setRichText:NO]; + [textView setEditable:NO]; + [textView setSelectable:YES]; + [textView setVerticallyResizable:YES]; + [textView setHorizontallyResizable:NO]; + [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 removeObjectForKey:[window title]]; +} + +//---------------------------------------------------------------------------- +// Server +//---------------------------------------------------------------------------- + - (BOOL)registerProjectSubmenu:(NSMenu *)menu { } @@ -91,7 +211,7 @@ { } -- (BOOL)querTouchedFiles +- (BOOL)queryTouchedFiles { } diff --git a/PCLib/ProjectCenter.h b/PCLib/ProjectCenter.h index 37d09d1..a7feac5 100644 --- a/PCLib/ProjectCenter.h +++ b/PCLib/ProjectCenter.h @@ -42,6 +42,7 @@ #define BundlePaths @"BundlePaths" #define SuccessSound @"SuccessSound" #define FailureSound @"FailureSound" +#define ExternalEditor @"ExternalEditor" #define PCAppDidInitNotification @"PCAppDidInit" #define PCAppWillTerminateNotification @"PCAppWillTerminate" @@ -59,6 +60,8 @@ #import "PCProjectManager.h" #import "PCServer.h" #import "PCProject.h" +#import "PCProjectBuilder.h" +#import "PCProjectDebugger.h" #import "PCFileManager.h" #import "PCBrowserController.h" #import "ProjectDebugger.h" @@ -68,4 +71,8 @@ #import "PreferenceController.h" #import "ProjectBuilder.h" #import "FileCreator.h" -#import "PCProjectBuilder.h" +#import "PCEditorView.h" + + + + diff --git a/PCLib/Server.h b/PCLib/Server.h index 463d61c..aa036f2 100644 --- a/PCLib/Server.h +++ b/PCLib/Server.h @@ -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; diff --git a/PCLibProj/ChangeLog b/PCLibProj/ChangeLog new file mode 100644 index 0000000..14a067a --- /dev/null +++ b/PCLibProj/ChangeLog @@ -0,0 +1,48 @@ +2000-10-15 20:29 robert + + * PCLibProject.m: some code improvements regarding the inspector + +2000-09-24 15:37 robert + + * PCLibProject.m: minor UI issue + +2000-09-23 17:45 robert + + * PCLibMakefileFactory.m: another issue... + +2000-09-23 16:24 robert + + * PCLibMakefileFactory.m, PCLibProject.m: Fixed some makefile + issues + +2000-09-21 09:07 robert + + * PCLibMakefileFactory.m, PCLibProj.m: removed the English.lproj + stuff in libs + +2000-09-20 17:51 robert + + * ChangeLog: Added a changelog + +2000-09-17 14:13 robert + + * PCLibMakefileFactory.m: makefile improvements + +2000-08-27 21:13 robert + + * PCLibMakefileFactory.h, PCLibProj.h, GNUmakefile, + GNUmakefile.postamble, GNUmakefile.preamble, Info.table, + PCLibProj.m, Makefile, Makefile.postamble, Makefile.preamble, + PB.project, PC.proj, PCLibMakefileFactory.m, PCLibProject.h, + PCLibProject.m, h.template, m.template, LibProject.gmodel, Version: + Initial revision + +2000-08-27 21:13 robert + + * PCLibMakefileFactory.h, PCLibProj.h, GNUmakefile, + GNUmakefile.postamble, GNUmakefile.preamble, Info.table, + PCLibProj.m, Makefile, Makefile.postamble, Makefile.preamble, + PB.project, PC.proj, PCLibMakefileFactory.m, PCLibProject.h, + PCLibProject.m, h.template, m.template, LibProject.gmodel, Version: + Initial import + diff --git a/PCLibProj/PCLibMakefileFactory.m b/PCLibProj/PCLibMakefileFactory.m index 95a90ac..94e63b7 100644 --- a/PCLibProj/PCLibMakefileFactory.m +++ b/PCLibProj/PCLibMakefileFactory.m @@ -60,7 +60,7 @@ static PCLibMakefileFactory *_factory = nil; // The 'real' thing [string appendString:@"include $(GNUSTEP_MAKEFILES)/common.make\n"]; - [string appendString:@"include English.lproj/Version\n"]; + [string appendString:@"include Version\n"]; [string appendString:@"#\n\n"]; [string appendString:@"# Subprojects\n"]; @@ -83,13 +83,18 @@ 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:@"%@_INSTALLATION_DIR=$(GNUSTEP_LOCAL_ROOT)\n",[prName uppercaseString]]]; + [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 += ",libName]]; if ([[prDict objectForKey:PCLibraries] count]) { enumerator = [[prDict objectForKey:PCLibraries] objectEnumerator]; @@ -104,7 +109,7 @@ static PCLibMakefileFactory *_factory = nil; [string appendString:@"# Header files\n"]; [string appendString:@"#\n\n"]; - [string appendString:[NSString stringWithFormat:@"%@_HEADERS= ",libName]]; + [string appendString:[NSString stringWithFormat:@"%@_HEADER_FILES= ",libName]]; enumerator = [[prDict objectForKey:PCHeaders] objectEnumerator]; while (tmp = [enumerator nextObject]) { @@ -135,7 +140,7 @@ static PCLibMakefileFactory *_factory = nil; [string appendString:@"\n\n"]; - [string appendString:[NSString stringWithFormat:@"%@_HEADER_FILES_INSTALL_DIR=/%@\n",libName,prName]]; + [string appendFormat:@"HEADERS_INSTALL = $(%@_HEADER_FILES)\n\n",libName]; [string appendString:@"-include GNUmakefile.preamble\n"]; [string appendString:@"-include GNUmakefile.local\n"]; diff --git a/PCLibProj/PCLibProj.m b/PCLibProj/PCLibProj.m index 009d01a..ce1392b 100644 --- a/PCLibProj/PCLibProj.m +++ b/PCLibProj/PCLibProj.m @@ -103,11 +103,14 @@ static PCLibProj *_creator = nil; [fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"main.m"] handler:nil]; // Resources + /* _resourcePath = [path stringByAppendingPathComponent:@"English.lproj"]; [fm createDirectoryAtPath:_resourcePath attributes:nil]; + */ + [fm createDirectoryAtPath:[path stringByAppendingPathComponent:@"Documentation"] attributes:nil]; _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"Version" ofType:@""]; - [fm copyPath:_file toPath:[_resourcePath stringByAppendingPathComponent:@"Version"] handler:nil]; + [fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"Version"] handler:nil]; // The path cannot be in the PC.project file! [project setProjectPath:path]; diff --git a/PCLibProj/PCLibProject.h b/PCLibProj/PCLibProject.h index 1633041..57e459d 100644 --- a/PCLibProj/PCLibProject.h +++ b/PCLibProj/PCLibProject.h @@ -37,8 +37,6 @@ @interface PCLibProject : PCProject { - @private - BOOL _needsAdditionalReleasing; } //---------------------------------------------------------------------------- @@ -62,4 +60,6 @@ - (NSArray *)buildTargets; - (NSString *)projectDescription; +- (void)updateValuesFromProjectDict; + @end diff --git a/PCLibProj/PCLibProject.m b/PCLibProj/PCLibProject.m index ef2a37c..8f7121d 100644 --- a/PCLibProj/PCLibProject.m +++ b/PCLibProj/PCLibProject.m @@ -43,31 +43,7 @@ - (void)_initUI { - // Always call super!!! [super _initUI]; - - projectAttributeInspectorView = [[NSBox alloc] init]; - [projectAttributeInspectorView setTitlePosition:NSAtTop]; - [projectAttributeInspectorView setBorderType:NSGrooveBorder]; - // [projectAttributeInspectorView addSubview:projectTypePopup]; - [projectAttributeInspectorView sizeToFit]; - [projectAttributeInspectorView setAutoresizingMask:NSViewWidthSizable]; - - projectProjectInspectorView = [[NSBox alloc] init]; - [projectProjectInspectorView setTitlePosition:NSAtTop]; - [projectProjectInspectorView setBorderType:NSGrooveBorder]; - // [projectProjectInspectorView addSubview:projectTypePopup]; - [projectProjectInspectorView sizeToFit]; - [projectProjectInspectorView setAutoresizingMask:NSViewWidthSizable]; - - projectFileInspectorView = [[NSBox alloc] init]; - [projectFileInspectorView setTitlePosition:NSAtTop]; - [projectFileInspectorView setBorderType:NSGrooveBorder]; - // [projectFileInspectorView addSubview:projectTypePopup]; - [projectFileInspectorView sizeToFit]; - [projectFileInspectorView setAutoresizingMask:NSViewWidthSizable]; - - _needsAdditionalReleasing = YES; } @end @@ -80,34 +56,27 @@ - (id)init { - if ((self = [super init])) { - rootCategories = [[NSDictionary dictionaryWithObjectsAndKeys:PCClasses,@"Classes",PCHeaders,@"Headers",PCOtherSources,@"Other Sources",PCOtherResources,@"Other Resources", PCSubprojects, @"Subprojects", PCLibraries, @"Libraries",PCDocuFiles,@"Documentation",nil] retain]; - - _needsAdditionalReleasing = NO; - -#if defined(GNUSTEP) - [self _initUI]; -#else - if(![NSBundle loadNibNamed:@"LibProject.nib" owner:self]) { - [[NSException exceptionWithName:NIB_NOT_FOUND_EXCEPTION reason:@"Could not load LibProject.gmodel" userInfo:nil] raise]; - return nil; - } -#endif - } - return self; + if ((self = [super init])) { + rootCategories = [[NSDictionary dictionaryWithObjectsAndKeys: + PCSubprojects, @"Subprojects", + PCLibraries, @"Libraries", + PCDocuFiles,@"Documentation", + PCOtherResources,@"Other Resources", + PCOtherSources,@"Other Sources", + PCHeaders,@"Headers", + PCClasses,@"Classes", + nil] retain]; + + [self _initUI]; + } + return self; } - (void)dealloc { - [rootCategories release]; - - if (_needsAdditionalReleasing) { - [projectAttributeInspectorView release]; - [projectProjectInspectorView release]; - [projectFileInspectorView release]; - } - - [super dealloc]; + [rootCategories release]; + + [super dealloc]; } //---------------------------------------------------------------------------- @@ -117,7 +86,7 @@ - (BOOL)writeMakefile { NSFileManager *fm = [NSFileManager defaultManager]; - NSString *makefile = [projectPath stringByAppendingPathComponent:@"GNUmakefile"]; + NSString *makefile = [[self projectPath] stringByAppendingPathComponent:@"GNUmakefile"]; NSData *content; if (![super writeMakefile]) { @@ -169,4 +138,11 @@ return @"Project that handles GNUstep/ObjC based libraries."; } +- (void)updateValuesFromProjectDict +{ + [super updateValuesFromProjectDict]; + + //[appClassField setStringValue:[projectDict objectForKey:PCAppClass]]; +} + @end diff --git a/PCToolProj/ChangeLog b/PCToolProj/ChangeLog new file mode 100644 index 0000000..823ced9 --- /dev/null +++ b/PCToolProj/ChangeLog @@ -0,0 +1,36 @@ +2000-11-04 13:41 robert + + * PCToolProject.h, PCToolProject.m: The project type is executable + +2000-10-15 20:29 robert + + * PCToolProject.m: some code improvements regarding the inspector + +2000-10-11 15:15 robert + + * PCToolProject.m: daily work + +2000-09-22 11:24 robert + + * PCToolMakefileFactory.m: Fix in the makefile generation section + +2000-09-03 22:10 robert + + * GNUmakefile.preamble: renamed libPC into libProjectCenter + +2000-08-27 21:13 robert + + * PCToolProj.h, PCToolProj.m, h.template, m.template, Info.table, + PCToolProject.m, GNUmakefile.postamble, GNUmakefile.preamble, + PCToolProject.h, main.m, PCToolMakefileFactory.m, GNUmakefile, + Info-project.plist, PC.proj, PCToolMakefileFactory.h: Initial + revision + +2000-08-27 21:13 robert + + * PCToolProj.h, PCToolProj.m, h.template, m.template, Info.table, + PCToolProject.m, GNUmakefile.postamble, GNUmakefile.preamble, + PCToolProject.h, main.m, PCToolMakefileFactory.m, GNUmakefile, + Info-project.plist, PC.proj, PCToolMakefileFactory.h: Initial + import + diff --git a/PCToolProj/GNUmakefile.preamble b/PCToolProj/GNUmakefile.preamble index f61a96d..49b00fc 100644 --- a/PCToolProj/GNUmakefile.preamble +++ b/PCToolProj/GNUmakefile.preamble @@ -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 += diff --git a/PCToolProj/PCToolMakefileFactory.m b/PCToolProj/PCToolMakefileFactory.m index 55b6eaf..7d6817f 100644 --- a/PCToolProj/PCToolMakefileFactory.m +++ b/PCToolProj/PCToolMakefileFactory.m @@ -84,7 +84,7 @@ static PCToolMakefileFactory *_factory = nil; [string appendString:@"# Additional libraries\n"]; [string appendString:@"#\n\n"]; - [string appendString:[NSString stringWithFormat:@"%@_ADDITIONAL_TOOL_LIBS += ",prName]]; + [string appendString:[NSString stringWithFormat:@"%@_TOOL_LIBS += ",prName]]; if ([[prDict objectForKey:PCLibraries] count]) { enumerator = [[prDict objectForKey:PCLibraries] objectEnumerator]; diff --git a/PCToolProj/PCToolProject.h b/PCToolProj/PCToolProject.h index 9f304ac..15b03e9 100644 --- a/PCToolProj/PCToolProject.h +++ b/PCToolProj/PCToolProject.h @@ -38,8 +38,6 @@ @interface PCToolProject : PCProject { - @private - BOOL _needsAdditionalReleasing; } //---------------------------------------------------------------------------- @@ -63,5 +61,9 @@ - (NSArray *)buildTargets; - (NSString *)projectDescription; +- (BOOL)isExecutable; + +- (void)updateValuesFromProjectDict; + @end diff --git a/PCToolProj/PCToolProject.m b/PCToolProj/PCToolProject.m index d14cda5..8e7db33 100644 --- a/PCToolProj/PCToolProject.m +++ b/PCToolProj/PCToolProject.m @@ -43,31 +43,7 @@ - (void)_initUI { - // Always call super!!! [super _initUI]; - - projectAttributeInspectorView = [[NSBox alloc] init]; - [projectAttributeInspectorView setTitlePosition:NSAtTop]; - [projectAttributeInspectorView setBorderType:NSGrooveBorder]; - // [projectAttributeInspectorView addSubview:projectTypePopup]; - [projectAttributeInspectorView sizeToFit]; - [projectAttributeInspectorView setAutoresizingMask:NSViewWidthSizable]; - - projectProjectInspectorView = [[NSBox alloc] init]; - [projectProjectInspectorView setTitlePosition:NSAtTop]; - [projectProjectInspectorView setBorderType:NSGrooveBorder]; - // [projectProjectInspectorView addSubview:projectTypePopup]; - [projectProjectInspectorView sizeToFit]; - [projectProjectInspectorView setAutoresizingMask:NSViewWidthSizable]; - - projectFileInspectorView = [[NSBox alloc] init]; - [projectFileInspectorView setTitlePosition:NSAtTop]; - [projectFileInspectorView setBorderType:NSGrooveBorder]; - // [projectFileInspectorView addSubview:projectTypePopup]; - [projectFileInspectorView sizeToFit]; - [projectFileInspectorView setAutoresizingMask:NSViewWidthSizable]; - - _needsAdditionalReleasing = YES; } @end @@ -80,41 +56,28 @@ - (id)init { - if ((self = [super init])) { - rootCategories = [[NSDictionary dictionaryWithObjectsAndKeys: + if ((self = [super init])) { + rootCategories = [[NSDictionary dictionaryWithObjectsAndKeys: 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:@"ToolProject.nib" owner:self]) { - [[NSException exceptionWithName:NIB_NOT_FOUND_EXCEPTION reason:@"Could not load ToolProject.gmodel" userInfo:nil] raise]; - return nil; - } -#endif - } - return self; + PCOtherResources,@"Other Resources", + PCSubprojects,@"Subprojects", + PCLibraries,@"Libraries", + PCDocuFiles,@"Documentation", + PCOtherSources,@"Other Sources", + PCHeaders,@"Headers", + PCClasses,@"Classes", + nil] retain]; + + [self _initUI]; + } + return self; } - (void)dealloc { - [rootCategories release]; - - if (_needsAdditionalReleasing) { - [projectAttributeInspectorView release]; - [projectProjectInspectorView release]; - [projectFileInspectorView release]; - } - - [super dealloc]; + [rootCategories release]; + + [super dealloc]; } //---------------------------------------------------------------------------- @@ -176,4 +139,16 @@ return @"Project that handles GNUstep/ObjC based tools."; } +- (BOOL)isExecutable +{ + return YES; +} + +- (void)updateValuesFromProjectDict +{ + [super updateValuesFromProjectDict]; + + //[appClassField setStringValue:[projectDict objectForKey:PCAppClass]]; +} + @end diff --git a/ProjectCenter/ChangeLog b/ProjectCenter/ChangeLog new file mode 100644 index 0000000..50a5ad1 --- /dev/null +++ b/ProjectCenter/ChangeLog @@ -0,0 +1,142 @@ +2000-11-04 18:11 robert + + * PCPrefController.m: some interface changes + +2000-11-04 17:48 robert + + * PCAppController.m, PCPrefController.m: the bundle path is now + depending on the GNUSTEP_LOCAL_ROOT env variable + +2000-10-29 13:16 robert + + * Info-project.plist: some GWorkspace additions + +2000-10-29 13:01 robert + + * Info-project.plist: 0.2 coming soon + +2000-10-20 20:20 robert + + * Makefile, Makefile.postamble, Makefile.preamble, PB.project: + remove old PB support + +2000-10-20 20:18 robert + + * PC.project: updated project file + +2000-10-20 20:13 robert + + * GNUmakefile, ProjectCenter_clean.tiff, ProjectCenter_debug.tiff, + ProjectCenter_install.tiff, ProjectCenter_make.tiff, + ProjectCenter_profile.tiff: added build images + +2000-10-20 17:18 robert + + * PCAppController.m: Support for protocols in file creation + +2000-10-15 20:23 robert + + * PCAppController.h, PCAppController.m: modified launching + behaviour + +2000-10-15 14:25 robert + + * PCPrefController.m: UI improvement + +2000-09-21 09:32 robert + + * PCPrefController.m: bundle path issue now fixed, hopefully... + +2000-09-21 07:42 robert + + * PCAppController.m, PCPrefController.m: open file now works, too + +2000-09-20 17:50 robert + + * ChangeLog: Added a changelog + +2000-09-20 17:46 robert + + * ProjectCenter_main.m: Added the font panel stuff + +2000-09-20 12:35 robert + + * PCPrefController.m: some more work on the preferences + +2000-09-17 16:40 robert + + * PCPrefController.h, PCPrefController.m: Basic preferences + handling + +2000-09-17 14:12 robert + + * GNUmakefile, Info-project.plist, PCAppController+MenuHandling.h, + PCAppController+MenuHandling.m, PCAppController.m, + PCMenuController.m, ProjectCenter_main.m, ProjectCentre_build.tiff, + ProjectCentre_find.tiff, ProjectCentre_prefs.tiff, + ProjectCentre_settings.tiff, ProjectCentre_uml.tiff: Updated some + images, fixed some bugs and enhanced the featurelist... + +2000-09-14 11:04 robert + + * PCAppController.m: another minor flaw + +2000-09-14 10:28 robert + + * PCAppController.m: fixed some bugs introduced by removing the + gmodel + +2000-09-13 12:45 robert + + * GNUmakefile, PCAppController+MenuHandling.h, + PCAppController+MenuHandling.m, PCAppController.h, + PCAppController.m, PCMenuController.h, PCMenuController.m, + ProjectCenter_main.m, English.lproj/ProjectCenter.gmodel: removed + the gmodels completely from ProjectCenter.app + +2000-09-03 21:59 robert + + * GNUmakefile.preamble, PC.project, PCAppController.m: minor stuff + +2000-09-03 21:15 robert + + * PCAppController.m: New DO code + +2000-08-27 21:12 robert + + * Makefile.preamble, PB.project, h.template, m.template, Makefile, + ProjectCenter_main.m, Makefile.postamble, PCAppController.h, + PCAppController.m, PCPrefController.h, PCPrefController.m, + PCFindController.h, PCFindController.m, PCInfoController.h, + PCInfoController.m, PCLogController.h, PCLogController.m, + PCMenuController.h, ProjectCenter.tiff, PCMenuController.m, + GNUmakefile, GNUmakefile.postamble, GNUmakefile.preamble, + PC.project, FileIcon_.m.tiff, ProjectCentre_documentation.tiff, + ProjectCentre_cvs.tiff, ProjectCentre_prefs.tiff, + ProjectCenter.app.tiff, FileIcon_rtf.tiff, + ProjectCentre_files.tiff, FileIcon_.c.tiff, + ProjectCentre_clean.tiff, ProjectCentre_find.tiff, + FileIcon_.h.tiff, Info-project.plist, ProjectCentre_add.tiff, + ProjectCentre_build.tiff, ProjectCentre_run.tiff, + ProjectCentre_uml.tiff, English.lproj/ProjectCenter.gmodel: Initial + revision + +2000-08-27 21:12 robert + + * Makefile.preamble, PB.project, h.template, m.template, Makefile, + ProjectCenter_main.m, Makefile.postamble, PCAppController.h, + PCAppController.m, PCPrefController.h, PCPrefController.m, + PCFindController.h, PCFindController.m, PCInfoController.h, + PCInfoController.m, PCLogController.h, PCLogController.m, + PCMenuController.h, ProjectCenter.tiff, PCMenuController.m, + GNUmakefile, GNUmakefile.postamble, GNUmakefile.preamble, + PC.project, FileIcon_.m.tiff, ProjectCentre_documentation.tiff, + ProjectCentre_cvs.tiff, ProjectCentre_prefs.tiff, + ProjectCenter.app.tiff, FileIcon_rtf.tiff, + ProjectCentre_files.tiff, FileIcon_.c.tiff, + ProjectCentre_clean.tiff, ProjectCentre_find.tiff, + FileIcon_.h.tiff, Info-project.plist, ProjectCentre_add.tiff, + ProjectCentre_build.tiff, ProjectCentre_run.tiff, + ProjectCentre_uml.tiff, English.lproj/ProjectCenter.gmodel: Initial + import + diff --git a/ProjectCenter/English.lproj/ProjectCenter.gmodel b/ProjectCenter/English.lproj/ProjectCenter.gmodel deleted file mode 100755 index 17573e3..0000000 --- a/ProjectCenter/English.lproj/ProjectCenter.gmodel +++ /dev/null @@ -1,1734 +0,0 @@ -{ - "Object 1" = { - elements = ( - "Object 2", - "Object 114", - "Object 115", - "Object 116", - "Object 117", - "Object 118", - "Object 119", - "Object 120", - "Object 121", - "Object 122" - ); - 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 = ProjectCenter; - }; - "Object 12" = { - elements = ( - "Object 13", - "Object 20", - "Object 36", - "Object 46", - "Object 53", - "Object 98", - "Object 104", - "Object 110", - "Object 112", - "Object 113" - ); - 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 = 7; 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 = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Info Panel..."; - }; - "Object 18" = { - action = nil; - image = nil; - isEnabled = YES; - 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 = Project; - }; - "Object 21" = { - autoenablesItems = YES; - isa = NSMenu; - itemArray = "Object 22"; - title = Project; - }; - "Object 22" = { - elements = ( - "Object 23", - "Object 24", - "Object 25", - "Object 26", - "Object 27", - "Object 28", - "Object 29", - "Object 30" - ); - isa = NSMutableArray; - }; - "Object 23" = { - action = nil; - image = nil; - isEnabled = NO; - isa = NSMenuItem; - keyEquivalent = o; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Open...; - }; - "Object 24" = { - action = nil; - image = nil; - isEnabled = NO; - isa = NSMenuItem; - keyEquivalent = n; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = New; - }; - "Object 25" = { - action = nil; - image = nil; - isEnabled = NO; - isa = NSMenuItem; - keyEquivalent = s; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Save; - }; - "Object 26" = { - action = nil; - image = nil; - isEnabled = NO; - isa = NSMenuItem; - keyEquivalent = S; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Save As..."; - }; - "Object 27" = { - action = nil; - image = nil; - isEnabled = NO; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Save All"; - }; - "Object 28" = { - action = nil; - image = nil; - isEnabled = NO; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Revert to Saved"; - }; - "Object 29" = { - action = nil; - image = nil; - isEnabled = NO; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Close; - }; - "Object 30" = { - action = "submenuAction:"; - image = "Object 14"; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = "Object 31"; - title = Subproject; - }; - "Object 31" = { - autoenablesItems = YES; - isa = NSMenu; - itemArray = "Object 32"; - title = Subproject; - }; - "Object 32" = { - elements = ("Object 33", "Object 34", "Object 35"); - isa = NSMutableArray; - }; - "Object 33" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Add; - }; - "Object 34" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = New; - }; - "Object 35" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Remove; - }; - "Object 36" = { - action = "submenuAction:"; - image = "Object 14"; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = "Object 37"; - title = File; - }; - "Object 37" = { - autoenablesItems = YES; - isa = NSMenu; - itemArray = "Object 38"; - title = File; - }; - "Object 38" = { - elements = ( - "Object 39", - "Object 40", - "Object 41", - "Object 42", - "Object 43", - "Object 44", - "Object 45" - ); - isa = NSMutableArray; - }; - "Object 39" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = O; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Open; - }; - "Object 40" = { - action = nil; - image = nil; - isEnabled = NO; - isa = NSMenuItem; - keyEquivalent = A; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Add File"; - }; - "Object 41" = { - action = nil; - image = nil; - isEnabled = NO; - isa = NSMenuItem; - keyEquivalent = N; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "New in Project"; - }; - "Object 42" = { - action = nil; - image = nil; - isEnabled = NO; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Remove File"; - }; - "Object 43" = { - action = nil; - image = nil; - isEnabled = NO; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Save; - }; - "Object 44" = { - action = nil; - image = nil; - isEnabled = NO; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Save As..."; - }; - "Object 45" = { - action = nil; - image = nil; - isEnabled = NO; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Revert to Saved"; - }; - "Object 46" = { - action = "submenuAction:"; - image = "Object 14"; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = "Object 47"; - title = Edit; - }; - "Object 47" = { - autoenablesItems = YES; - isa = NSMenu; - itemArray = "Object 48"; - title = Edit; - }; - "Object 48" = { - elements = ("Object 49", "Object 50", "Object 51", "Object 52"); - isa = NSMutableArray; - }; - "Object 49" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = x; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Cut; - }; - "Object 50" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = c; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Copy; - }; - "Object 51" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = v; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Paste; - }; - "Object 52" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = a; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Select All"; - }; - "Object 53" = { - action = "submenuAction:"; - image = "Object 14"; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = "Object 54"; - title = Format; - }; - "Object 54" = { - autoenablesItems = YES; - isa = NSMenu; - itemArray = "Object 55"; - title = Format; - }; - "Object 55" = { - elements = ("Object 56", "Object 87", "Object 97"); - isa = NSMutableArray; - }; - "Object 56" = { - action = "submenuAction:"; - image = "Object 14"; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = "Object 57"; - title = Font; - }; - "Object 57" = { - autoenablesItems = YES; - isa = NSMenu; - itemArray = "Object 58"; - title = Font; - }; - "Object 58" = { - elements = ( - "Object 59", - "Object 60", - "Object 61", - "Object 62", - "Object 63", - "Object 70", - "Object 76", - "Object 84", - "Object 85", - "Object 86" - ); - isa = NSMutableArray; - }; - "Object 59" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = t; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Font Panel..."; - }; - "Object 60" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = b; - representedObject = nil; - state = 0; - tag = 2; - target = nil; - title = Bold; - }; - "Object 61" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = i; - representedObject = nil; - state = 0; - tag = 1; - target = nil; - title = Italic; - }; - "Object 62" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Underline; - }; - "Object 63" = { - action = "submenuAction:"; - image = "Object 14"; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = "Object 64"; - title = Kern; - }; - "Object 64" = { - autoenablesItems = YES; - isa = NSMenu; - itemArray = "Object 65"; - title = Kern; - }; - "Object 65" = { - elements = ("Object 66", "Object 67", "Object 68", "Object 69"); - isa = NSMutableArray; - }; - "Object 66" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Use Default"; - }; - "Object 67" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Use None"; - }; - "Object 68" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Tighten; - }; - "Object 69" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Loosen; - }; - "Object 70" = { - action = "submenuAction:"; - image = "Object 14"; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = "Object 71"; - title = Ligature; - }; - "Object 71" = { - autoenablesItems = YES; - isa = NSMenu; - itemArray = "Object 72"; - title = Ligature; - }; - "Object 72" = { - elements = ("Object 73", "Object 74", "Object 75"); - isa = NSMutableArray; - }; - "Object 73" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Use Default"; - }; - "Object 74" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Use None"; - }; - "Object 75" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Use All"; - }; - "Object 76" = { - action = "submenuAction:"; - image = "Object 14"; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = "Object 77"; - title = Baseline; - }; - "Object 77" = { - autoenablesItems = YES; - isa = NSMenu; - itemArray = "Object 78"; - title = Baseline; - }; - "Object 78" = { - elements = ("Object 79", "Object 80", "Object 81", "Object 82", "Object 83"); - isa = NSMutableArray; - }; - "Object 79" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Use Default"; - }; - "Object 80" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Superscript; - }; - "Object 81" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Subscript; - }; - "Object 82" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Raise; - }; - "Object 83" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Lower; - }; - "Object 84" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Colors...; - }; - "Object 85" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = 3; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Copy Font"; - }; - "Object 86" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = 4; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Paste Font"; - }; - "Object 87" = { - action = "submenuAction:"; - image = "Object 14"; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = "Object 88"; - title = Text; - }; - "Object 88" = { - autoenablesItems = YES; - isa = NSMenu; - itemArray = "Object 89"; - title = Text; - }; - "Object 89" = { - elements = ( - "Object 90", - "Object 91", - "Object 92", - "Object 93", - "Object 94", - "Object 95", - "Object 96" - ); - isa = NSMutableArray; - }; - "Object 90" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Align Left"; - }; - "Object 91" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Center; - }; - "Object 92" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Justify; - }; - "Object 93" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Align Right"; - }; - "Object 94" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Show Ruler"; - }; - "Object 95" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = 1; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Copy Ruler"; - }; - "Object 96" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = 2; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Paste Ruler"; - }; - "Object 97" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = P; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Page Layout..."; - }; - "Object 98" = { - action = "submenuAction:"; - image = "Object 14"; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = "Object 99"; - title = Tools; - }; - "Object 99" = { - autoenablesItems = YES; - isa = NSMenu; - itemArray = "Object 100"; - title = Tools; - }; - "Object 100" = { - elements=("Object 101", "Object 102", "Object 103"); - isa = NSMutableArray; - }; - "Object 101" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Inspector...; - }; - "Object 102" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Loaded Projects..."; - }; - "Object 103" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = f; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Find Panel"; - }; - "Object 104" = { - action = "submenuAction:"; - image = "Object 14"; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = "Object 105"; - title = Windows; - }; - "Object 105" = { - autoenablesItems = YES; - isa = NSMenu; - itemArray = "Object 106"; - title = Windows; - }; - "Object 106" = { - elements = ("Object 107", "Object 108", "Object 109"); - isa = NSMutableArray; - }; - "Object 107" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Arrange in Front"; - }; - "Object 108" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = m; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Miniaturize Window"; - }; - "Object 109" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = w; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = "Close Window"; - }; - "Object 110" = { - action = "submenuAction:"; - image = "Object 14"; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = ""; - representedObject = nil; - state = 0; - tag = 0; - target = "Object 111"; - title = Services; - }; - "Object 111" = { - autoenablesItems = YES; - isa = NSMenu; - itemArray = "Object 7"; - title = Services; - }; - "Object 112" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = h; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Hide; - }; - "Object 113" = { - action = nil; - image = nil; - isEnabled = YES; - isa = NSMenuItem; - keyEquivalent = q; - representedObject = nil; - state = 0; - tag = 0; - target = nil; - title = Quit; - }; - "Object 114" = {className = PCInfoController; isa = IMCustomObject; }; - "Object 115" = {className = PCFindController; isa = IMCustomObject; }; - "Object 116" = {className = NSFontManager; isa = IMCustomObject; }; - "Object 117" = {className = PCLogController; isa = IMCustomObject; }; - "Object 118" = {className = PCPrefController; isa = IMCustomObject; }; - "Object 119" = {className = PCProjectManager; isa = IMCustomObject; }; - "Object 120" = {className = PCAppController; isa = IMCustomObject; }; - "Object 121" = {className = PCMenuController; isa = IMCustomObject; }; - "Object 122" = {className = PCFileManager; isa = IMCustomObject; }; - "Object 123" = { - elements = ( - "Object 124", - "Object 126", - "Object 128", - "Object 130", - "Object 132", - "Object 134", - "Object 136", - "Object 138", - "Object 140", - "Object 142", - "Object 144", - "Object 146", - "Object 148", - "Object 150", - "Object 152", - "Object 154", - "Object 156", - "Object 158", - "Object 160", - "Object 162", - "Object 164", - "Object 166", - "Object 168", - "Object 170", - "Object 172", - "Object 173", - "Object 175", - "Object 177", - "Object 179", - "Object 181", - "Object 183", - "Object 185", - "Object 187", - "Object 189", - "Object 191", - "Object 193", - "Object 195", - "Object 197", - "Object 199", - "Object 201", - "Object 203", - "Object 205", - "Object 207", - "Object 209", - "Object 210", - "Object 212", - "Object 214", - "Object 215", - "Object 216", - "Object 218", - "Object 219", - "Object 221", - "Object 223", - "Object 225", - "Object 227", - "Object 229", - "Object 231", - "Object 233", - "Object 235", - "Object 236", - "Object 238", - "Object 240", - "Object 242", - "Object 244", - "Object 246", - "Object 248", - "Object 249", - "Object 251" - ); - isa = NSMutableArray; - }; - "Object 124" = { - destination = nil; - isa = IMControlConnector; - label = "Object 125"; - source = "Object 49"; - }; - "Object 125" = {isa = NSString; string = "cut:"; }; - "Object 126" = { - destination = nil; - isa = IMControlConnector; - label = "Object 127"; - source = "Object 50"; - }; - "Object 127" = {isa = NSString; string = "copy:"; }; - "Object 128" = { - destination = nil; - isa = IMControlConnector; - label = "Object 129"; - source = "Object 51"; - }; - "Object 129" = {isa = NSString; string = "paste:"; }; - "Object 130" = { - destination = nil; - isa = IMControlConnector; - label = "Object 131"; - source = "Object 52"; - }; - "Object 131" = {isa = NSString; string = "selectAll:"; }; - "Object 132" = { - destination = "Object 2"; - isa = IMControlConnector; - label = "Object 133"; - source = "Object 113"; - }; - "Object 133" = {isa = NSString; string = "terminate:"; }; - "Object 134" = { - destination = "Object 2"; - isa = IMControlConnector; - label = "Object 135"; - source = "Object 112"; - }; - "Object 135" = {isa = NSString; string = "hide:"; }; - "Object 136" = { - destination = nil; - isa = IMControlConnector; - label = "Object 137"; - source = "Object 108"; - }; - "Object 137" = {isa = NSString; string = "performMiniaturize:"; }; - "Object 138" = { - destination = nil; - isa = IMControlConnector; - label = "Object 139"; - source = "Object 109"; - }; - "Object 139" = {isa = NSString; string = "performClose:"; }; - "Object 140" = { - destination = nil; - isa = IMControlConnector; - label = "Object 141"; - source = "Object 107"; - }; - "Object 141" = {isa = NSString; string = "arrangeInFront:"; }; - "Object 142" = { - destination = "Object 120"; - isa = IMOutletConnector; - label = "Object 143"; - source = "Object 2"; - }; - "Object 143" = {isa = NSString; string = delegate; }; - "Object 144" = { - destination = nil; - isa = IMControlConnector; - label = "Object 145"; - source = "Object 84"; - }; - "Object 145" = {isa = NSString; string = "orderFrontColorPanel:"; }; - "Object 146" = { - destination = nil; - isa = IMControlConnector; - label = "Object 147"; - source = "Object 79"; - }; - "Object 147" = {isa = NSString; string = "unscript:"; }; - "Object 148" = { - destination = nil; - isa = IMControlConnector; - label = "Object 149"; - source = "Object 80"; - }; - "Object 149" = {isa = NSString; string = "superscript:"; }; - "Object 150" = { - destination = nil; - isa = IMControlConnector; - label = "Object 151"; - source = "Object 81"; - }; - "Object 151" = {isa = NSString; string = "subscript:"; }; - "Object 152" = { - destination = nil; - isa = IMControlConnector; - label = "Object 153"; - source = "Object 82"; - }; - "Object 153" = {isa = NSString; string = "raiseBaseline:"; }; - "Object 154" = { - destination = nil; - isa = IMControlConnector; - label = "Object 155"; - source = "Object 83"; - }; - "Object 155" = {isa = NSString; string = "lowerBaseline:"; }; - "Object 156" = { - destination = nil; - isa = IMControlConnector; - label = "Object 157"; - source = "Object 75"; - }; - "Object 157" = {isa = NSString; string = "useAllLigatures:"; }; - "Object 158" = { - destination = nil; - isa = IMControlConnector; - label = "Object 159"; - source = "Object 74"; - }; - "Object 159" = {isa = NSString; string = "turnOffLigatures:"; }; - "Object 160" = { - destination = nil; - isa = IMControlConnector; - label = "Object 161"; - source = "Object 73"; - }; - "Object 161" = {isa = NSString; string = "useStandardLigatures:"; }; - "Object 162" = { - destination = nil; - isa = IMControlConnector; - label = "Object 163"; - source = "Object 66"; - }; - "Object 163" = {isa = NSString; string = "useStandardKerning:"; }; - "Object 164" = { - destination = nil; - isa = IMControlConnector; - label = "Object 165"; - source = "Object 67"; - }; - "Object 165" = {isa = NSString; string = "turnOffKerning:"; }; - "Object 166" = { - destination = nil; - isa = IMControlConnector; - label = "Object 167"; - source = "Object 68"; - }; - "Object 167" = {isa = NSString; string = "tightenKerning:"; }; - "Object 168" = { - destination = nil; - isa = IMControlConnector; - label = "Object 169"; - source = "Object 69"; - }; - "Object 169" = {isa = NSString; string = "loosenKerning:"; }; - "Object 170" = { - destination = "Object 116"; - isa = IMControlConnector; - label = "Object 171"; - source = "Object 61"; - }; - "Object 171" = {isa = NSString; string = "addFontTrait:"; }; - "Object 172" = { - destination = "Object 116"; - isa = IMControlConnector; - label = "Object 171"; - source = "Object 60"; - }; - "Object 173" = { - destination = nil; - isa = IMControlConnector; - label = "Object 174"; - source = "Object 62"; - }; - "Object 174" = {isa = NSString; string = "underline:"; }; - "Object 175" = { - destination = nil; - isa = IMControlConnector; - label = "Object 176"; - source = "Object 86"; - }; - "Object 176" = {isa = NSString; string = "pasteFont:"; }; - "Object 177" = { - destination = nil; - isa = IMControlConnector; - label = "Object 178"; - source = "Object 85"; - }; - "Object 178" = {isa = NSString; string = "copyFont:"; }; - "Object 179" = { - destination = "Object 116"; - isa = IMControlConnector; - label = "Object 180"; - source = "Object 59"; - }; - "Object 180" = {isa = NSString; string = "orderFrontFontPanel:"; }; - "Object 181" = { - destination = nil; - isa = IMControlConnector; - label = "Object 182"; - source = "Object 97"; - }; - "Object 182" = {isa = NSString; string = "runPageLayout:"; }; - "Object 183" = { - destination = nil; - isa = IMControlConnector; - label = "Object 184"; - source = "Object 94"; - }; - "Object 184" = {isa = NSString; string = "toggleRuler:"; }; - "Object 185" = { - destination = nil; - isa = IMControlConnector; - label = "Object 186"; - source = "Object 96"; - }; - "Object 186" = {isa = NSString; string = "pasteRuler:"; }; - "Object 187" = { - destination = nil; - isa = IMControlConnector; - label = "Object 188"; - source = "Object 95"; - }; - "Object 188" = {isa = NSString; string = "copyRuler:"; }; - "Object 189" = { - destination = nil; - isa = IMControlConnector; - label = "Object 190"; - source = "Object 93"; - }; - "Object 190" = {isa = NSString; string = "alignRight:"; }; - "Object 191" = { - destination = nil; - isa = IMControlConnector; - label = "Object 192"; - source = "Object 91"; - }; - "Object 192" = {isa = NSString; string = "alignCenter:"; }; - "Object 193" = { - destination = nil; - isa = IMControlConnector; - label = "Object 194"; - source = "Object 90"; - }; - "Object 194" = {isa = NSString; string = "alignLeft:"; }; - "Object 195" = { - destination = nil; - isa = IMControlConnector; - label = "Object 196"; - source = "Object 92"; - }; - "Object 196" = {isa = NSString; string = "alignJustified:"; }; - "Object 197" = { - destination = "Object 118"; - isa = IMOutletConnector; - label = "Object 198"; - source = "Object 120"; - }; - "Object 198" = {isa = NSString; string = prefController; }; - "Object 199" = { - destination = "Object 115"; - isa = IMOutletConnector; - label = "Object 200"; - source = "Object 120"; - }; - "Object 200" = {isa = NSString; string = finder; }; - "Object 201" = { - destination = "Object 114"; - isa = IMOutletConnector; - label = "Object 202"; - source = "Object 120"; - }; - "Object 202" = {isa = NSString; string = infoController; }; - "Object 203" = { - destination = "Object 117"; - isa = IMOutletConnector; - label = "Object 204"; - source = "Object 120"; - }; - "Object 204" = {isa = NSString; string = logger; }; - "Object 205" = { - destination = "Object 114"; - isa = IMControlConnector; - label = "Object 206"; - source = "Object 17"; - }; - "Object 206" = {isa = NSString; string = "showInfoWindow:"; }; - "Object 207" = { - destination = "Object 118"; - isa = IMControlConnector; - label = "Object 208"; - source = "Object 18"; - }; - "Object 208" = {isa = NSString; string = "showPrefWindow:"; }; - "Object 209" = { - destination = "Object 120"; - isa = IMOutletConnector; - label = "Object 143"; - source = "Object 119"; - }; - "Object 210" = { - destination = "Object 119"; - isa = IMOutletConnector; - label = "Object 211"; - source = "Object 120"; - }; - "Object 211" = {isa = NSString; string = projectManager; }; - "Object 212" = { - destination = "Object 122"; - isa = IMOutletConnector; - label = "Object 213"; - source = "Object 119"; - }; - "Object 213" = {isa = NSString; string = fileManager; }; - "Object 214" = { - destination = "Object 119"; - isa = IMOutletConnector; - label = "Object 143"; - source = "Object 122"; - }; - "Object 215" = { - destination = "Object 122"; - isa = IMOutletConnector; - label = "Object 213"; - source = "Object 120"; - }; - "Object 216" = { - destination = "Object 121"; - isa = IMOutletConnector; - label = "Object 217"; - source = "Object 120"; - }; - "Object 217" = {isa = NSString; string = menuController; }; - "Object 218" = { - destination = "Object 119"; - isa = IMOutletConnector; - label = "Object 211"; - source = "Object 121"; - }; - "Object 219" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 220"; - source = "Object 23"; - }; - "Object 220" = {isa = NSString; string = "openProject:"; }; - "Object 221" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 222"; - source = "Object 24"; - }; - "Object 222" = {isa = NSString; string = "newProject:"; }; - "Object 223" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 224"; - source = "Object 25"; - }; - "Object 224" = {isa = NSString; string = "saveProject:"; }; - "Object 225" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 226"; - source = "Object 26"; - }; - "Object 226" = {isa = NSString; string = "saveProjectAs:"; }; - "Object 227" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 228"; - source = "Object 28"; - }; - "Object 228" = {isa = NSString; string = "revertToSaved:"; }; - "Object 229" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 230"; - source = "Object 29"; - }; - "Object 230" = {isa = NSString; string = "closeProject:"; }; - "Object 231" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 232"; - source = "Object 33"; - }; - "Object 232" = {isa = NSString; string = "addSubproject:"; }; - "Object 233" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 234"; - source = "Object 34"; - }; - "Object 234" = {isa = NSString; string = "newSubproject:"; }; - "Object 235" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 234"; - source = "Object 35"; - }; - "Object 236" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 237"; - source = "Object 39"; - }; - "Object 237" = {isa = NSString; string = "openFile:"; }; - "Object 238" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 239"; - source = "Object 40"; - }; - "Object 239" = {isa = NSString; string = "addFile:"; }; - "Object 240" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 241"; - source = "Object 42"; - }; - "Object 241" = {isa = NSString; string = "removeFile:"; }; - "Object 242" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 243"; - source = "Object 43"; - }; - "Object 243" = {isa = NSString; string = "saveFile:"; }; - "Object 244" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 245"; - source = "Object 44"; - }; - "Object 245" = {isa = NSString; string = "saveFileAs:"; }; - "Object 246" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 247"; - source = "Object 45"; - }; - "Object 247" = {isa = NSString; string = "revertFile:"; }; - "Object 248" = { - destination = "Object 122"; - isa = IMOutletConnector; - label = "Object 213"; - source = "Object 121"; - }; - "Object 249" = { - destination = "Object 121"; - isa = IMControlConnector; - label = "Object 250"; - source = "Object 41"; - }; - "Object 250" = {isa = NSString; string = "newFile:"; }; - "Object 251" = { - destination = "Object 120"; - isa = IMOutletConnector; - label = "Object 252"; - source = "Object 121"; - }; - "Object 252" = {isa = NSString; string = appController; }; - RootObject = {Connections = "Object 123"; Objects = "Object 1"; isa = GMModel; }; - TopLevelObjects = (RootObject); - Version = 1; -} - - - diff --git a/ProjectCenter/GNUmakefile b/ProjectCenter/GNUmakefile index 36fe6b4..7f2827f 100644 --- a/ProjectCenter/GNUmakefile +++ b/ProjectCenter/GNUmakefile @@ -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,10 +35,16 @@ ProjectCenter_RESOURCE_FILES= \ ProjectCentre_prefs.tiff \ ProjectCentre_run.tiff \ ProjectCentre_uml.tiff \ + ProjectCentre_settings.tiff \ FileIcon_.c.tiff \ FileIcon_.h.tiff \ FileIcon_.m.tiff \ FileIcon_rtf.tiff \ + ProjectCenter_make.tiff \ + ProjectCenter_clean.tiff \ + ProjectCenter_debug.tiff \ + ProjectCenter_profile.tiff \ + ProjectCenter_install.tiff \ Info-project.plist # Header files @@ -48,6 +52,7 @@ ProjectCenter_RESOURCE_FILES= \ ProjectCenter_HEADERS= \ PCAppController.h \ + PCAppController+MenuHandling.h \ PCFindController.h \ PCInfoController.h \ PCLogController.h \ @@ -60,6 +65,7 @@ ProjectCenter_HEADERS= \ ProjectCenter_OBJC_FILES= \ PCAppController.m \ + PCAppController+MenuHandling.m \ PCFindController.m \ PCInfoController.m \ PCLogController.m \ diff --git a/ProjectCenter/GNUmakefile.preamble b/ProjectCenter/GNUmakefile.preamble index 4126b8a..b8c8324 100644 --- a/ProjectCenter/GNUmakefile.preamble +++ b/ProjectCenter/GNUmakefile.preamble @@ -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 += diff --git a/ProjectCenter/Info-project.plist b/ProjectCenter/Info-project.plist index 752e4b5..66d659f 100755 --- a/ProjectCenter/Info-project.plist +++ b/ProjectCenter/Info-project.plist @@ -1,10 +1,30 @@ { + NSIcon = "ProjectCenter.tiff"; + NSRole = "Editor"; + NSTypes = ( + { + NSUnixExtensions = ( "project" ); + NSIcon = "ProjectCenter.tiff"; + }, + { + NSUnixExtensions = ( "m" ); + NSIcon = "FileIcon_.m.tiff"; + }, + { + NSUnixExtensions = ( "h" ); + NSIcon = "FileIcon_.h.tiff"; + }, + { + NSUnixExtensions = ( "c" ); + NSIcon = "FileIcon_.c.tiff"; + } + ); NOTE = "Automatically generated, do not edit!"; ApplicationName = "ProjectCenter"; ApplicationDescription = "GNUstep IDE"; ApplicationIcon = "ProjectCenter.tiff"; - ApplicationRelease = "ProjectCenter 0.1"; - FullVersionID = "0.1 pre pre pre pre epsilon"; + ApplicationRelease = "ProjectCenter 0.2"; + FullVersionID = "0.2"; Authors = ("Philippe C.D. Robert "); URL = "http://www.projectcenter.ch"; Copyright = "Copyright (C) 2000 Philippe C.D. Robert"; diff --git a/ProjectCenter/Makefile b/ProjectCenter/Makefile deleted file mode 100755 index a3d8274..0000000 --- a/ProjectCenter/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -# -# Generated by the NeXT Project Builder. -# -# NOTE: Do NOT change this file -- Project Builder maintains it. -# -# Put all of your customizations in files called Makefile.preamble -# and Makefile.postamble (both optional), and Makefile will include them. -# - -NAME = ProjectCenter - -PROJECTVERSION = 2.6 -PROJECT_TYPE = Application -LANGUAGE = English - -NEXTSTEP_APPICON = ProjectCenter.app.tiff -ICONSECTIONS = -sectcreate __ICON app ProjectCenter.app.tiff - -LOCAL_RESOURCES = FileCreation.nib Info.nib Inspector.nib\ - NEXTSTEP_ProjectCenter.nib Preferences.nib Project.nib\ - TypePopup.nib - -GLOBAL_RESOURCES = FileIcon_.c.tiff FileIcon_.h.tiff FileIcon_.m.tiff\ - FileIcon_rtf.tiff ProjectCenter.app.tiff\ - ProjectCenter.tiff ProjectCentre_add.tiff\ - ProjectCentre_build.tiff ProjectCentre_clean.tiff\ - ProjectCentre_cvs.tiff\ - ProjectCentre_documentation.tiff\ - ProjectCentre_files.tiff ProjectCentre_find.tiff\ - ProjectCentre_prefs.tiff ProjectCentre_run.tiff\ - ProjectCentre_uml.tiff - -CLASSES = PCAppController.m PCPrefController.m PCInfoController.m\ - PCFindController.m PCLogController.m PCMenuController.m - -HFILES = PCAppController.h PCPrefController.h PCInfoController.h\ - PCFindController.h PCLogController.h PCMenuController.h - -MFILES = ProjectCenter_main.m - -OTHERSRCS = Makefile.preamble Makefile Makefile.postamble m.template\ - h.template - - -MAKEFILEDIR = $(NEXT_ROOT)/NextDeveloper/Makefiles/pb_makefiles -CODE_GEN_STYLE = DYNAMIC -MAKEFILE = app.make -NEXTSTEP_INSTALLDIR = $(HOME)/Apps -WINDOWS_INSTALLDIR = /MyApps -LIBS = -lPCLib -DEBUG_LIBS = $(LIBS) -PROF_LIBS = $(LIBS) - - -HEADER_PATHS = -I/LocalDeveloper/Headers/PCLib -FRAMEWORKS = -framework AppKit -framework Foundation - - -include $(MAKEFILEDIR)/platform.make - --include Makefile.preamble - -include $(MAKEFILEDIR)/$(MAKEFILE) - --include Makefile.postamble - --include Makefile.dependencies diff --git a/ProjectCenter/Makefile.postamble b/ProjectCenter/Makefile.postamble deleted file mode 100755 index 36381d4..0000000 --- a/ProjectCenter/Makefile.postamble +++ /dev/null @@ -1,122 +0,0 @@ -############################################################################### -# NeXT Makefile.postamble -# Copyright 1996, NeXT Software, Inc. -# -# This Makefile is used for configuring the standard app makefiles associated -# with ProjectBuilder. -# -# Use this template to set attributes for a project, sub-project, bundle, or -# palette. Each node in the project's tree of sub-projects and bundles -# should have it's own Makefile.preamble and Makefile.postamble. Additional -# rules (e.g., after_install) that are defined by the developer should be -# defined in this file. -# -############################################################################### -# -# Here are the variables exported by the common "app" makefiles that can be -# used in any customizations you make to the template below: -# -# PRODUCT_ROOT - Name of the directory to which resources are copied. -# OFILE_DIR - Directory into which .o object files are generated. -# (Note that this name is calculated based on the target -# architectures specified in Project Builder). -# DERIVED_SRC_DIR - Directory used for all other derived files -# ALL_CFLAGS - All the flags passed to the cc(1) driver for compilations -# -# NAME - name of application, bundle, subproject, palette, etc. -# LANGUAGE - langage in which the project is written (default "English") -# LOCAL_RESOURCES - localized resources (e.g. nib's, images) of project -# GLOBAL_RESOURCES - non-localized resources of project -# PROJECTVERSION - version of ProjectBuilder project (NS3.X = 1.1, NS4.0 = 2.0) -# ICONSECTIONS - Specifies icon sections when linking executable -# -# CLASSES - Class implementation files in project. -# HFILES - Header files in project. -# MFILES - Other Objective-C source files in project. -# CFILES - Other C source files in project. -# PSWFILES - .psw files in the project -# PSWMFILES - .pswm files in the project -# SUBPROJECTS - Subprojects of this project -# BUNDLES - Bundle subprojects of this project -# OTHERSRCS - Other miscellaneous sources of this project -# OTHERLINKED - Source files not matching a standard source extention -# -# LIBS - Libraries to link with when making app target -# DEBUG_LIBS - Libraries to link with when making debug target -# PROF_LIBS - Libraries to link with when making profile target -# OTHERLINKEDOFILES - Other relocatable files to (always) link in. -# -# APP_MAKEFILE_DIR - Directory in which to find generic set of Makefiles -# MAKEFILEDIR - Directory in which to find $(MAKEFILE) -# MAKEFILE - Top level mechanism Makefile (e.g., app.make, bundle.make) -# INSTALLDIR - Directory app will be installed into by 'install' target -# -############################################################################### - - -# Change defaults assumed by the standard makefiles here. Edit the -# following default values as appropriate. (Note that if no Makefile.postamble -# exists, these values will have defaults set in common.make). - -# Versioning of frameworks, libraries, bundles, and palettes: -#CURRENTLY_ACTIVE_VERSION = YES - # Set to "NO" to produce a compatibility binary -#DEPLOY_WITH_VERSION_NAME = A - # This should be incremented as your API changes. -#COMPATIBILITY_PROJECT_VERSION = 1 - # This should be incremented as your API grows. -#CURRENT_PROJECT_VERSION = 1 - # Defaults to using the "vers_string" hack. - -# Some compiler flags can be easily overridden here, but onlytake effect at -# the top-level: -#OPTIMIZATION_CFLAG = -O -#DEBUG_SYMBOLS_CFLAG = -g -#WARNING_CFLAGS = -Wmost -#DEBUG_BUILD_CFLAGS = -DDEBUG -#PROFILE_BUILD_CFLAGS = -pg -DPROFILE - -# This definition will suppress stripping of debug symbols when an executable -# is installed. By default it is YES. -# STRIP_ON_INSTALL = NO - -# Flags passed to yacc -#YFLAGS = -d - -# Library and Framework projects only: -# 1. If you want something other than the default .dylib name, override it here -#DYLIB_INSTALL_NAME = lib$(NAME).dylib - -# 2. If you want to change the -install_name flag from the absolute path to the development area, change it here. One good choice is the installation directory. Another one might be none at all. -#DYLIB_INSTALL_DIR = $(INSTALLDIR) - -# Ownership and permissions of files installed by 'install' target -#INSTALL_AS_USER = root - # User/group ownership -#INSTALL_AS_GROUP = wheel - # (probably want to set both of these) -#INSTALL_PERMISSIONS = - # If set, 'install' chmod's executable to this - -# Options to strip for various project types. Note: -S strips debugging symbols -# (executables can be stripped down further with -x or, if they load no bundles, with no -# options at all). -#APP_STRIP_OPTS = -S -#TOOL_STRIP_OPTS = -S -#LIBRARY_STRIP_OPTS = -S - # for .a archives -#DYNAMIC_STRIP_OPTS = -S - # for bundles and shared libraries - -######################################################################### -# Put rules to extend the behavior of the standard Makefiles here. "Official" -# user-defined rules are: -# * before_install -# * after_install -# * after_installhdrs -# You should avoid redefining things like "install" or "app", as they are -# owned by the top-level Makefile API and no context has been set up for where -# derived files should go. -# -# Note: on MS Windows, executables, have an extension, so rules and dependencies -# for generated tools should use $(EXECUTABLE_EXT) on the end. diff --git a/ProjectCenter/Makefile.preamble b/ProjectCenter/Makefile.preamble deleted file mode 100755 index 5c0a25a..0000000 --- a/ProjectCenter/Makefile.preamble +++ /dev/null @@ -1,130 +0,0 @@ -############################################################################### -# NeXT Makefile.preamble -# Copyright 1996, NeXT Software, Inc. -# -# This Makefile is used for configuring the standard app makefiles associated -# with ProjectBuilder. -# -# Use this template to set attributes for a project. Each node in a project -# tree of sub-projects, tools, etc. should have its own Makefile.preamble and -# Makefile.postamble. -# -############################################################################### -## Configure the flags passed to $(CC) here. These flags will also be -## inherited by all nested sub-projects and bundles. Put your -I, -D, -U, and -## -L flags in ProjectBuilder's Build Options inspector if at all possible. -## To change the default flags that get passed to ${CC} -## (e.g. change -O to -O2), see Makefile.postamble. - -# Flags passed to compiler (in addition to -g, -O, etc) -OTHER_CFLAGS = -# Flags passed to ld (in addition to -ObjC, etc.) -OTHER_LDFLAGS = -# Flags passed to libtool when building libraries -OTHER_LIBTOOL_FLAGS = -# For ordering named sections on NEXTSTEP (see ld(1)) -SECTORDER_FLAGS = - -# If you do not want any headers exported before compilations begin, -# uncomment the following line. This can be a big time saver. -#SKIP_EXPORTING_HEADERS = YES - -# Stuff related to exporting headers from this project that isn't already -# handled by PB. -OTHER_PUBLIC_HEADERS = -OTHER_PROJECT_HEADERS = -OTHER_PRIVATE_HEADERS = - -# Set these two macros if you want a precomp to be built as part of -# installation. The cc -precomp will be run in the public header directory -# on the specified public header files with the specified additional flags. -PUBLIC_PRECOMPILED_HEADERS = -PUBLIC_PRECOMPILED_HEADERS_CFLAGS = - -# Set this for library projects if you want to publish header files. If your -# app or tool project exports headers Don't -# include $(DSTROOT); this is added for you automatically. -PUBLIC_HEADER_DIR = -PRIVATE_HEADER_DIR = - -# If, in a subproject, you want to append to the parent's PUBLIC_HEADER_DIR# -# (say, to add a subdirectory like "/sys"), you can use: -PUBLIC_HEADER_DIR_SUFFIX = -PRIVATE_HEADER_DIR_SUFFIX = - -# Set this for dynamic library projects on platforms where code which references -# a dynamic library must link against an import library (i.e., Windows NT) -# Don't include $(DSTROOT); this is added for you automatically. -IMPORT_LIBRARY_DIR = - -# Additional (non-localized) resources for this project, which can be generated -OTHER_RESOURCES = - -# Uncomment this to produce a static archive-style (.a) library -#LIBRARY_STYLE = STATIC - -# Set this to YES if you don't want a final libtool call for a library/framework. -BUILD_OFILES_LIST_ONLY = - -# Additional relocatables to be linked into this project -OTHER_OFILES = -# Additional libraries to link against -OTHER_LIBS = -# To include a version string, project source must exist in a directory named -# $(NAME).%d[.%d][.%d] and the following line must be uncommented. -# OTHER_GENERATED_OFILES = $(VERS_OFILE) - -## Configure how things get built here. Additional dependencies, source files, -## derived files, and build order should be specified here. - -# Other dependencies of this project -OTHER_PRODUCT_DEPENDS = -# Built *before* building subprojects/bundles -OTHER_INITIAL_TARGETS = -# Other source files maintained by .pre/postamble -OTHER_SOURCEFILES = -# Additional files to be removed by `make clean' -OTHER_GARBAGE = - -# Targets to build before installation -OTHER_INSTALL_DEPENDS = - -# More obscure flags you might want to set for pswrap, yacc, lex, etc. -PSWFLAGS = -YFLAGS = -LFLAGS = - -## Delete this line if you want fast and loose cleans that will not remove -## things like precomps and user-defined OTHER_GARBAGE in subprojects. -CLEAN_ALL_SUBPROJECTS = YES - -## Add more obscure source files here to cause them to be automatically -## processed by the appropriate tool. Note that these files should also be -## added to "Supporting Files" in ProjectBuilder. The desired .o files that -## result from these files should also be added to OTHER_OFILES above so they -## will be linked in. - -# .msg files that should have msgwrap run on them -MSGFILES = -# .defs files that should have mig run on them -DEFSFILES = -# .mig files (no .defs files) that should have mig run on them -MIGFILES = -# .x files that should have rpcgen run on them -RPCFILES = - -## Add additional Help directories here (add them to the project as "Other -## Resources" in Project Builder) so that they will be compressed into .store -## files and copied into the app wrapper. If the help directories themselves -## need to also be in the app wrapper, then a cp command will need to be added -## in an after_install target. -OTHER_HELP_DIRS = - -# After you have saved your project using the 4.0 PB, you will automatically -# start using the makefiles in /NextDeveloper/Makefiles/project. If you should -# need to revert back to the old 3.3 Makefile behavior, override MAKEFILEDIR to -# be /NextDeveloper/Makefiles/app. - -# Don't add more rules here unless you want the first one to be the default -# target for make! Put all your targets in Makefile.postamble. - diff --git a/ProjectCenter/PB.project b/ProjectCenter/PB.project deleted file mode 100755 index 53c28b4..0000000 --- a/ProjectCenter/PB.project +++ /dev/null @@ -1,77 +0,0 @@ -{ - APPCLASS = NSApplication; - DYNAMIC_CODE_GEN = YES; - FILESTABLE = { - CLASSES = ( - PCAppController.m, - PCPrefController.m, - PCInfoController.m, - PCFindController.m, - PCLogController.m, - PCMenuController.m - ); - FRAMEWORKS = (AppKit.framework, Foundation.framework); - HEADERSEARCH = (/LocalDeveloper/Headers/PCLib); - H_FILES = ( - PCAppController.h, - PCPrefController.h, - PCInfoController.h, - PCFindController.h, - PCLogController.h, - PCMenuController.h - ); - IMAGES = ( - FileIcon_.c.tiff, - FileIcon_.h.tiff, - FileIcon_.m.tiff, - FileIcon_rtf.tiff, - ProjectCenter.app.tiff, - ProjectCenter.tiff, - ProjectCentre_add.tiff, - ProjectCentre_build.tiff, - ProjectCentre_clean.tiff, - ProjectCentre_cvs.tiff, - ProjectCentre_documentation.tiff, - ProjectCentre_files.tiff, - ProjectCentre_find.tiff, - ProjectCentre_prefs.tiff, - ProjectCentre_run.tiff, - ProjectCentre_uml.tiff - ); - INTERFACES = ( - FileCreation.nib, - Info.nib, - Inspector.nib, - NEXTSTEP_ProjectCenter.nib, - Preferences.nib, - Project.nib, - TypePopup.nib - ); - OTHER_LIBS = (PCLib); - OTHER_LINKED = (ProjectCenter_main.m); - OTHER_SOURCES = (Makefile.preamble, Makefile, Makefile.postamble, m.template, h.template); - }; - LANGUAGE = English; - LOCALIZABLE_FILES = { - FileCreation.nib = FileCreation.nib; - Info.nib = Info.nib; - Inspector.nib = Inspector.nib; - NEXTSTEP_ProjectCenter.nib = NEXTSTEP_ProjectCenter.nib; - Preferences.nib = Preferences.nib; - Project.nib = Project.nib; - TypePopup.nib = TypePopup.nib; - }; - MAKEFILEDIR = "$(NEXT_ROOT)/NextDeveloper/Makefiles/pb_makefiles"; - NEXTSTEP_APPICON = ProjectCenter.app.tiff; - NEXTSTEP_BUILDTOOL = /bin/gnumake; - NEXTSTEP_DOCUMENTEXTENSIONS = (); - NEXTSTEP_INSTALLDIR = "$(HOME)/Apps"; - NEXTSTEP_MAINNIB = NEXTSTEP_ProjectCenter.nib; - PDO_UNIX_BUILDTOOL = $NEXT_ROOT/NextDeveloper/bin/make; - PROJECTNAME = ProjectCenter; - PROJECTTYPE = Application; - PROJECTVERSION = 2.6; - WINDOWS_BUILDTOOL = $NEXT_ROOT/NextDeveloper/Executables/make; - WINDOWS_INSTALLDIR = /MyApps; - WINDOWS_MAINNIB = WINDOWS_ProjectCenter.nib; -} diff --git a/ProjectCenter/PC.project b/ProjectCenter/PC.project index 5080dcc..467d85a 100644 --- a/ProjectCenter/PC.project +++ b/ProjectCenter/PC.project @@ -3,69 +3,77 @@ APPKIT = "GNUSTEP-GUI"; APPLICATIONICON = ""; BUILDTOOL = gnumake; - "CLASS_FILES" = ( - "PCAppController.m", - "PCFindController.m", - "PCInfoController.m", - "PCLogController.m", - "PCMenuController.m", - "ProjectCenter_main.m" + CLASS_FILES = ( + PCAppController.m, + PCFindController.m, + PCInfoController.m, + PCLogController.m, + PCMenuController.m, + PCPrefController.m, + ProjectCenter_main.m, + "PCAppController+MenuHandling.m" ); COMPILEROPTIONS = ""; - "CREATION_DATE" = ""; - "DOCU_FILES" = ( + CREATION_DATE = ""; + DOCU_FILES = ( ); FOUNDATION = "GNUSTEP-BASE"; FRAMEWORKS = ( ); - "HEADER_FILES" = ( - "PCAppController.h", - "PCFindController.h", - "PCInfoController.h", - "PCLogController.h", - "PCMenuController.h", - "PCPrefController.h" + HEADER_FILES = ( + PCAppController.h, + PCFindController.h, + PCInfoController.h, + PCLogController.h, + PCMenuController.h, + PCPrefController.h, + "PCAppController+MenuHandling.h" ); IMAGES = ( - "build.tiff" + FileIcon_.c.tiff, + FileIcon_.h.tiff, + FileIcon_.m.tiff, + FileIcon_rtf.tiff, + ProjectCenter.app.tiff, + ProjectCenter.tiff, + ProjectCenter_clean.tiff, + ProjectCenter_debug.tiff, + ProjectCenter_install.tiff, + ProjectCenter_make.tiff, + ProjectCenter_profile.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" = ""; + LAST_EDITING = ""; LIBRARIES = ( "gnustep-base", - "gnustep-gui" + "gnustep-gui", + ProjectCenter ); - MAININTERFACE = "main.gmodel"; - MAKEFILEDIR = "/usr/GNUstep/Makefiles"; - "OTHER_FILES" = ( + MAININTERFACE = main.gmodel; + MAKEFILEDIR = /usr/GNUstep/Makefiles; + OTHER_FILES = ( ); - "OTHER_RESOURCES" = ( + OTHER_RESOURCES = ( ); - "OTHER_SOURCES" = ( + OTHER_SOURCES = ( ); - "PRINCIPAL_CLASS" = "ProjectCenter_main.m"; - "PROJECT_BUILDER" = PCAppProj; - "PROJECT_CREATOR" = ""; - "PROJECT_DESCRIPTION" = "No description avaliable!"; - "PROJECT_MAINTAINER" = ""; - "PROJECT_NAME" = PC; - "PROJECT_TYPE" = PCAppProject; - "PROJECT_VERSION" = "1.0"; + PRINCIPAL_CLASS = ProjectCenter_main.m; + PROJECT_BUILDER = PCAppProj; + PROJECT_CREATOR = ""; + PROJECT_DESCRIPTION = "No description avaliable!"; + PROJECT_MAINTAINER = ""; + PROJECT_NAME = ProjectCenter; + PROJECT_TYPE = PCAppProject; + PROJECT_VERSION = 1.0; SUBPROJECTS = ( ); - "SUPPORTING_FILES" = ( - "GNUmakefile.preamble", + SUPPORTING_FILES = ( + GNUmakefile.preamble, GNUmakefile, - "GNUmakefile.postamble" + GNUmakefile.postamble ); } \ No newline at end of file diff --git a/ProjectCenter/PCAppController+MenuHandling.h b/ProjectCenter/PCAppController+MenuHandling.h new file mode 100644 index 0000000..1cda1c9 --- /dev/null +++ b/ProjectCenter/PCAppController+MenuHandling.h @@ -0,0 +1,64 @@ +/* + GNUstep ProjectCenter - http://www.projectcenter.ch + + Copyright (C) 2000 Philippe C.D. Robert + + Author: Philippe C.D. Robert + + 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 +#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 + + + diff --git a/ProjectCenter/PCAppController+MenuHandling.m b/ProjectCenter/PCAppController+MenuHandling.m new file mode 100644 index 0000000..b2ccd72 --- /dev/null +++ b/ProjectCenter/PCAppController+MenuHandling.m @@ -0,0 +1,150 @@ +/* + GNUstep ProjectCenter - http://www.projectcenter.ch + + Copyright (C) 2000 Philippe C.D. Robert + + Author: Philippe C.D. Robert + + 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 + +@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 diff --git a/ProjectCenter/PCAppController.h b/ProjectCenter/PCAppController.h index 4ec7dfa..7fd53eb 100644 --- a/ProjectCenter/PCAppController.h +++ b/ProjectCenter/PCAppController.h @@ -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; } //============================================================================ @@ -89,7 +89,11 @@ //==== Misc... //============================================================================ +- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName; + +- (void)applicationWillFinishLaunching:(NSNotification *)notification; - (void)applicationDidFinishLaunching:(NSNotification *)notification; + - (BOOL)applicationShouldTerminate:(id)sender; - (void)applicationWillTerminate:(NSNotification *)notification; @@ -97,8 +101,6 @@ //==== Delegate stuff //============================================================================ -- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; - - (void)bundleLoader:(id)sender didLoadBundle:(NSBundle *)aBundle; @end @@ -108,4 +110,4 @@ - (BOOL)registerProjectCreator:(NSString *)className forKey:(NSString *)aKey; // Returns YES upon successfully registering a new projecttype. -@end \ No newline at end of file +@end diff --git a/ProjectCenter/PCAppController.m b/ProjectCenter/PCAppController.m index 8ca8f02..9586e08 100644 --- a/ProjectCenter/PCAppController.m +++ b/ProjectCenter/PCAppController.m @@ -38,12 +38,16 @@ + (void)initialize { NSMutableDictionary *defaults = [NSMutableDictionary dictionary]; + NSDictionary *env = [[NSProcessInfo processInfo] environment]; + NSString *prefix = [env objectForKey:@"GNUSTEP_LOCAL_ROOT"]; + NSString *_bundlePath; -#if defined(GNUSTEP) - NSString *_bundlePath = @"/usr/GNUstep/Local/Library/ProjectCenter"; -#else - NSString *_bundlePath = @"/LocalLibrary/ProjectCenter"; -#endif + if (prefix && ![prefix isEqualToString:@""]) { + _bundlePath = [prefix stringByAppendingPathComponent:@"Library/ProjectCenter"]; + } + else { + _bundlePath = [NSString stringWithString:@"/usr/GNUstep/Local/Library/ProjectCenter"]; + } [defaults setObject:_bundlePath forKey:BundlePaths]; @@ -51,6 +55,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,23 +81,45 @@ // 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; } - (void)dealloc { - if (doConnection) { - [doConnection invalidate]; - [doConnection release]; - } - - [projectManager release]; - [bundleLoader release]; - [doServer release]; - [projectTypes release]; - - [super dealloc]; + if (doConnection) { + [doConnection invalidate]; + [doConnection release]; + } + + [prefController release]; + [finder release]; + [infoController release]; + [logger release]; + [projectManager release]; + [fileManager release]; + [menuController release]; + + [bundleLoader release]; + [doServer release]; + [projectTypes release]; + + [super dealloc]; } //============================================================================ @@ -100,12 +128,12 @@ - (id)delegate { - return delegate; + return delegate; } - (void)setDelegate:(id)aDelegate { - delegate = aDelegate; + delegate = aDelegate; } //============================================================================ @@ -114,74 +142,83 @@ - (PCBundleLoader *)bundleLoader { - return bundleLoader; + return bundleLoader; } - (PCProjectManager *)projectManager { - return projectManager; + return projectManager; } - (PCPrefController *)prefController { - return prefController; + return prefController; } - (PCServer *)doServer { - return doServer; + return doServer; } - (PCFindController *)finder { - return finder; + return finder; } - (PCLogController *)logger { - return logger; + return logger; } - (NSDictionary *)projectTypes { - return projectTypes; + return projectTypes; } //============================================================================ //==== Misc... //============================================================================ +- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName +{ + if ([[fileName lastPathComponent] isEqualToString:@"PC.project"] == NO) { + return NO; + } + + return [projectManager openProjectAt:fileName]; +} + +- (void)applicationWillFinishLaunching:(NSNotification *)notification +{ + [bundleLoader loadBundles]; +} + - (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]; + //[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]; - // 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 @@ -213,18 +250,6 @@ //==== Delegate stuff //============================================================================ -- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename -{ - BOOL success = NO; - - if (([[filename lastPathComponent] isEqualToString:@"PC.proj"])) { - [projectManager openProjectAt:filename]; - success = YES; - } - - return success; -} - - (void)bundleLoader:(id)sender didLoadBundle:(NSBundle *)aBundle { Class principalClass; @@ -247,7 +272,7 @@ [fileManager registerCreatorsWithObjectsAndKeys:[[principalClass sharedCreator] creatorDictionary]]; // In objc.h there is already th like (char *)name... - // [logger logMessage:[NSString stringWithFormat:@"FileCreator %@ successfully loaded!",(NSString *)[[principalClass sharedCreator] name]] tag:INFORMATION]; + // [logger logMessage:[NSString stringWithFormat:@"FileCreator %@ successfully loaded!",(NSString *)[[principalClass sharedCreator] name]] tag:INFORMATION]; } } diff --git a/ProjectCenter/PCMenuController.h b/ProjectCenter/PCMenuController.h index 53b6439..fa5403c 100644 --- a/ProjectCenter/PCMenuController.h +++ b/ProjectCenter/PCMenuController.h @@ -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 //============================================================================ diff --git a/ProjectCenter/PCMenuController.m b/ProjectCenter/PCMenuController.m index bda1b5a..910bcfa 100644 --- a/ProjectCenter/PCMenuController.m +++ b/ProjectCenter/PCMenuController.m @@ -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]; + } + } } //============================================================================ diff --git a/ProjectCenter/PCPrefController.h b/ProjectCenter/PCPrefController.h index 834f8ab..b1f76d1 100644 --- a/ProjectCenter/PCPrefController.h +++ b/ProjectCenter/PCPrefController.h @@ -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; diff --git a/ProjectCenter/PCPrefController.m b/ProjectCenter/PCPrefController.m index 4c9edee..c891064 100644 --- a/ProjectCenter/PCPrefController.m +++ b/ProjectCenter/PCPrefController.m @@ -42,12 +42,12 @@ - (void)_initUI { NSView *_c_view; - unsigned int style = NSTitledWindowMask | NSClosableWindowMask | - NSResizableWindowMask; + unsigned int style = NSTitledWindowMask | NSClosableWindowMask; NSRect _w_frame; NSBox *line; NSBox *v; NSButton *b; + NSTextField *textField; /* * Pref Window @@ -58,10 +58,13 @@ prefWindow = [[NSWindow alloc] initWithContentRect:_w_frame styleMask:style backing:NSBackingStoreBuffered - defer:NO]; + defer:YES]; [prefWindow setMinSize:NSMakeSize(268,365)]; [prefWindow setTitle:@"Preferences"]; [prefWindow setDelegate:self]; + [prefWindow setReleasedWhenClosed:NO]; + [prefWindow center]; + [prefWindow setFrameAutosaveName:@"Preferences"]; _c_view = [prefWindow contentView]; prefPopup = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(72,328,120,20)]; @@ -104,6 +107,7 @@ [b setAction:@selector(setPromptOnClean:)]; [b setContinuous:NO]; [prefBuildingView addSubview:b]; + [b sizeToFit]; /* * Misc view @@ -116,23 +120,130 @@ [prefMiscView setBorderType:NSNoBorder]; v = [[[NSBox alloc] init] autorelease]; - [v setTitle:@"External"]; - [v setFrameFromContentFrame:NSMakeRect(16,184,228,96)]; + [v setTitle:@"External Tools"]; + [v setFrameFromContentFrame:NSMakeRect(16,192,228,88)]; [prefMiscView addSubview:v]; + /* + * Editor + */ + + textField = [[NSTextField alloc] initWithFrame:NSMakeRect(12,16,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,16,144,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,40,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,40,144,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,64,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,64,144,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]]; + + /* + * Bundles Box + */ + v = [[[NSBox alloc] init] autorelease]; - [v setTitle:@"Bundles"]; - [v setFrameFromContentFrame:NSMakeRect(16,120,228,48)]; + [v setTitle:@"Bundle Path"]; + [v setFrameFromContentFrame:NSMakeRect(16,104,228,48)]; [prefMiscView addSubview:v]; - b = [[[NSButton alloc] initWithFrame:NSMakeRect(32,80,144,15)] autorelease]; + /* + * Bundle path + */ + + bundlePathField = [[NSTextField alloc] initWithFrame:NSMakeRect(12,24,212,21)]; + [bundlePathField setAlignment: NSLeftTextAlignment]; + [bundlePathField setBordered: NO]; + [bundlePathField setEditable: YES]; + [bundlePathField setBezeled: YES]; + [bundlePathField setDrawsBackground: YES]; + [bundlePathField setTarget:self]; + [bundlePathField setAction:@selector(setBundlePath:)]; + [v addSubview:[bundlePathField autorelease]]; + + /* + * Some buttons + */ + + v = [[[NSBox alloc] init] autorelease]; + [v setTitle:@"Misc"]; + [v setFrameFromContentFrame:NSMakeRect(16,16,228,48)]; + [prefMiscView addSubview:v]; + + b = [[[NSButton alloc] initWithFrame:NSMakeRect(16,28,204,15)] autorelease]; [b setTitle:@"Prompt when quitting"]; [b setButtonType:NSSwitchButton]; [b setBordered:NO]; [b setTarget:self]; - // [b setAction:@selector(setPromptOnClean:)]; + // [b setAction:@selector()]; [b setContinuous:NO]; - [prefMiscView addSubview:b]; + [v addSubview:b]; + [b sizeToFit]; + + useExternalEditor =[[NSButton alloc] initWithFrame:NSMakeRect(16,8,220,15)]; + [useExternalEditor setTitle:@"Use external Editor"]; + [useExternalEditor setButtonType:NSSwitchButton]; + [useExternalEditor setBordered:NO]; + [useExternalEditor setTarget:self]; + [useExternalEditor setAction:@selector(setUseExternalEditor:)]; + [useExternalEditor setContinuous:NO]; + [v addSubview:[useExternalEditor autorelease]]; + [useExternalEditor sizeToFit]; /* * Saving view @@ -149,7 +260,7 @@ [v setFrameFromContentFrame:NSMakeRect(16,208,228,72)]; [prefSavingView addSubview:v]; - b = [[[NSButton alloc] initWithFrame:NSMakeRect(13,32,124,15)] autorelease]; + b = [[[NSButton alloc] initWithFrame:NSMakeRect(24,32,124,15)] autorelease]; [b setTitle:@"Save Automatically"]; [b setButtonType:NSSwitchButton]; [b setBordered:NO]; @@ -157,22 +268,22 @@ [b setAction:@selector(setSaveAutomatically:)]; [b setContinuous:NO]; [v addSubview:b]; + [b sizeToFit]; - b = [[[NSButton alloc] initWithFrame:NSMakeRect(13,13,124,15)] autorelease]; - [b setTitle:@"Remoe Backup"]; + b = [[[NSButton alloc] initWithFrame:NSMakeRect(24,12,124,15)] autorelease]; + [b setTitle:@"Remove Backup"]; [b setButtonType:NSSwitchButton]; [b setBordered:NO]; [b setTarget:self]; [b setAction:@selector(setRemoveBackup:)]; [b setContinuous:NO]; [v addSubview:b]; + [b sizeToFit]; v = [[[NSBox alloc] init] autorelease]; [v setTitle:@"Auto-Save"]; - [v setFrameFromContentFrame:NSMakeRect(16,104,228,80)]; + [v setFrameFromContentFrame:NSMakeRect(16,104,228,48)]; [prefSavingView addSubview:v]; - - _needsReleasing = YES; } @end @@ -182,7 +293,7 @@ - (id)init { if ((self = [super init])) { - NSDictionary *prefs; + NSDictionary *prefs; // The prefs from the defaults prefs = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]; @@ -195,39 +306,28 @@ { [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]; } - (void)showPrefWindow:(id)sender { + NSDictionary *prefs; + NSString *val; + if (!prefWindow) { - id view; - NSString *val; + id view; -#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 : @""]; // The popup and selected view [prefPopup removeAllItems]; @@ -241,52 +341,66 @@ [(NSBox *)prefEmptyView setContentView:view]; [prefEmptyView display]; } + + prefs = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]; + [preferencesDict addEntriesFromDictionary:prefs]; - [prefWindow center]; + // 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]; + + if (![prefWindow isVisible]) { + [prefWindow setFrameUsingName:@"Preferences"]; + } [prefWindow makeKeyAndOrderFront:self]; } - (void)popupChanged:(id)sender { - NSView *view = nil; + NSView *view = nil; + + switch([sender indexOfSelectedItem]) { + case 0: + view = [prefBuildingView retain]; + break; + case 1: + view = [prefSavingView retain]; + break; + case 2: + view = [prefMiscView retain]; + break; + } - switch([sender indexOfSelectedItem]) { - case 0: - view = [prefBuildingView retain]; - break; - case 1: - view = [prefSavingView retain]; - break; - case 2: - view = [prefMiscView retain]; - break; - } - [(NSBox *)prefEmptyView setContentView:view]; - [prefEmptyView display]; + [(NSBox *)prefEmptyView setContentView:view]; + [prefEmptyView display]; } - (void)setSuccessSound:(id)sender { - NSString *path = [self selectFileWithTypes:[NSArray arrayWithObjects:@"snd",@"au",nil]]; - - if (path) { - [successField setStringValue:path]; - - [[NSUserDefaults standardUserDefaults] setObject:path forKey:SuccessSound]; - [preferencesDict setObject:path forKey:SuccessSound]; - } + NSString *path = [self selectFileWithTypes:[NSArray arrayWithObjects:@"snd",@"au",nil]]; + + if (path) { + [successField setStringValue:path]; + + [[NSUserDefaults standardUserDefaults] setObject:path forKey:SuccessSound]; + [preferencesDict setObject:path forKey:SuccessSound]; + } } - (void)setFailureSound:(id)sender { - NSString *path = [self selectFileWithTypes:[NSArray arrayWithObjects:@"snd",@"au",nil]]; - - if (path) { - [failureField setStringValue:path]; - - [[NSUserDefaults standardUserDefaults] setObject:path forKey:FailureSound]; - [preferencesDict setObject:path forKey:FailureSound]; - } + NSString *path = [self selectFileWithTypes:[NSArray arrayWithObjects:@"snd",@"au",nil]]; + + if (path) { + [failureField setStringValue:path]; + + [[NSUserDefaults standardUserDefaults] setObject:path forKey:FailureSound]; + [preferencesDict setObject:path forKey:FailureSound]; + } } - (void)setPromptOnClean:(id)sender @@ -305,52 +419,59 @@ { } +- (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 { - NSString *path = [self selectFileWithTypes:[NSArray arrayWithObjects:@"bundle",nil]]; - - if (path) { - [bundlePathField setStringValue:path]; - - [[NSUserDefaults standardUserDefaults] setObject:path forKey:BundlePaths]; - [preferencesDict setObject:path forKey:BundlePaths]; - } + NSString *path = [bundlePathField stringValue]; + + if (path) { + [[NSUserDefaults standardUserDefaults] setObject:path forKey:BundlePaths]; + [preferencesDict setObject:path forKey:BundlePaths]; + } } - (void)promptWhenQuitting:(id)sender @@ -364,23 +485,24 @@ - (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 diff --git a/ProjectCenter/ProjectCenter_clean.tiff b/ProjectCenter/ProjectCenter_clean.tiff new file mode 100644 index 0000000..f6f7815 Binary files /dev/null and b/ProjectCenter/ProjectCenter_clean.tiff differ diff --git a/ProjectCenter/ProjectCenter_debug.tiff b/ProjectCenter/ProjectCenter_debug.tiff new file mode 100644 index 0000000..0d4cf79 Binary files /dev/null and b/ProjectCenter/ProjectCenter_debug.tiff differ diff --git a/ProjectCenter/ProjectCenter_install.tiff b/ProjectCenter/ProjectCenter_install.tiff new file mode 100644 index 0000000..b709cda Binary files /dev/null and b/ProjectCenter/ProjectCenter_install.tiff differ diff --git a/ProjectCenter/ProjectCenter_main.m b/ProjectCenter/ProjectCenter_main.m index e6d6e80..89ee675 100644 --- a/ProjectCenter/ProjectCenter_main.m +++ b/ProjectCenter/ProjectCenter_main.m @@ -25,7 +25,183 @@ */ #import +#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 *fontmenu; + 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:@"Fonts" action:NULL keyEquivalent:@""]; + + fontmenu = [[[NSMenu alloc] init] autorelease]; + [format setSubmenu:[[NSFontManager sharedFontManager] fontMenu: YES] forItem:[format itemWithTitle:@"Fonts"]]; + + /* + * 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]; } diff --git a/ProjectCenter/ProjectCenter_make.tiff b/ProjectCenter/ProjectCenter_make.tiff new file mode 100644 index 0000000..8fef7e6 Binary files /dev/null and b/ProjectCenter/ProjectCenter_make.tiff differ diff --git a/ProjectCenter/ProjectCenter_profile.tiff b/ProjectCenter/ProjectCenter_profile.tiff new file mode 100644 index 0000000..83f20e0 Binary files /dev/null and b/ProjectCenter/ProjectCenter_profile.tiff differ diff --git a/ProjectCenter/ProjectCentre_build.tiff b/ProjectCenter/ProjectCentre_build.tiff index 5ab5b20..90e755a 100644 Binary files a/ProjectCenter/ProjectCentre_build.tiff and b/ProjectCenter/ProjectCentre_build.tiff differ diff --git a/ProjectCenter/ProjectCentre_find.tiff b/ProjectCenter/ProjectCentre_find.tiff index c6e7e1c..8297e5b 100644 Binary files a/ProjectCenter/ProjectCentre_find.tiff and b/ProjectCenter/ProjectCentre_find.tiff differ diff --git a/ProjectCenter/ProjectCentre_prefs.tiff b/ProjectCenter/ProjectCentre_prefs.tiff index 5a4ddcb..c803f49 100644 Binary files a/ProjectCenter/ProjectCentre_prefs.tiff and b/ProjectCenter/ProjectCentre_prefs.tiff differ diff --git a/ProjectCenter/ProjectCentre_settings.tiff b/ProjectCenter/ProjectCentre_settings.tiff new file mode 100644 index 0000000..59e05f8 Binary files /dev/null and b/ProjectCenter/ProjectCentre_settings.tiff differ diff --git a/ProjectCenter/ProjectCentre_uml.tiff b/ProjectCenter/ProjectCentre_uml.tiff index 42304dd..dd6bdc9 100644 Binary files a/ProjectCenter/ProjectCentre_uml.tiff and b/ProjectCenter/ProjectCentre_uml.tiff differ diff --git a/README b/README index e60cc0e..4cbe652 100644 --- a/README +++ b/README @@ -1,9 +1,10 @@ README ****** - - THIS IS A DEVELOPER 'PRE RELEASE RELEASE' ONLY! It is meant to give a - sneak peak for those who want to help, it is not meant as a usable - application right now! + + This is an early release of ProjectCenter, the GNUstep IDE. Some + features are already implemented while a lot are not yet even + designed. The application is already usable for simple makefile + management and project building, though. If you want to volunteer, please contact me! @@ -19,5 +20,5 @@ TODOs Overall code improvements ... and a lot more! -Philippe C.D. Robert, 21.3.2000 +Philippe C.D. Robert, 27.10.2000 \ No newline at end of file diff --git a/Version b/Version index d8df70a..006b29c 100644 --- a/Version +++ b/Version @@ -6,7 +6,7 @@ GCC_VERSION=2.8.0 # The version number of this release. MAJOR_VERSION=0 -MINOR_VERSION=0 -SUBMINOR_VERSION=1 +MINOR_VERSION=2 +SUBMINOR_VERSION=0 PC_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION} VERSION=${PC_VERSION}