From 17a1df50636debae84a8fffa6c69318dcc0a0d5c Mon Sep 17 00:00:00 2001 From: Robert Slover Date: Thu, 14 Sep 2000 08:54:19 +0000 Subject: [PATCH] apps now don't use gmodels anymore git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@7510 72102866-910b-0410-8b05-ffd578937521 --- PCAppProj/AppController.h | 5 + PCAppProj/AppController.m | 12 + PCAppProj/AppProject.gmodel | 133 ---------- PCAppProj/GNUmakefile | 2 - PCAppProj/Main.gmodel | 436 ------------------------------- PCAppProj/PC.proj | 4 +- PCAppProj/PCAppMakefileFactory.m | 4 +- PCAppProj/main.m | 101 ++++++- 8 files changed, 121 insertions(+), 576 deletions(-) delete mode 100644 PCAppProj/AppProject.gmodel delete mode 100644 PCAppProj/Main.gmodel diff --git a/PCAppProj/AppController.h b/PCAppProj/AppController.h index 619b67b..c939174 100644 --- a/PCAppProj/AppController.h +++ b/PCAppProj/AppController.h @@ -19,4 +19,9 @@ - (void)awakeFromNib; +- (void)applicationDidFinishLaunching:(NSNotification *)notif; + +- (void)showPrefPanel:(id)sender; +- (void)showInfoPanel:(id)sender; + @end diff --git a/PCAppProj/AppController.m b/PCAppProj/AppController.m index 3829677..df86273 100644 --- a/PCAppProj/AppController.m +++ b/PCAppProj/AppController.m @@ -28,4 +28,16 @@ { } +- (void)applicationDidFinishLaunching:(NSNotification *)notif +{ +} + +- (void)showPrefPanel:(id)sender +{ +} + +- (void)showInfoPanel:(id)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/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/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..135fa46 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"]; diff --git a/PCAppProj/main.m b/PCAppProj/main.m index 1ef1c5b..e72328a 100644 --- a/PCAppProj/main.m +++ b/PCAppProj/main.m @@ -1,5 +1,104 @@ #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; + id pool = [[NSAutoreleasePool alloc] init]; + AppController *controller; + +#ifndef NX_CURRENT_COMPILER_RELEASE + initialize_gnustep_backend(); +#endif + + theApp = [NSApplication sharedApplication]; + + createMenu(); + + controller = [[AppController alloc] init]; + [theApp setDelegate:controller]; + + /* + * Go... + */ + + [theApp run]; + + /* + * ...and finish! + */ + + [controller release]; + [pool release]; + + return 0; } + +void createMenu() +{ + NSMenu *menu; + NSMenu *info; + NSMenu *edit; + NSMenu *services; + NSMenu *windows; + + SEL action = @selector(method:); + + menu = [[NSMenu alloc] initWithTitle:APP_NAME]; + + [menu addItemWithTitle:@"Info" action:action keyEquivalent:@""]; + [menu addItemWithTitle:@"Edit" action:action keyEquivalent:@""]; + [menu addItemWithTitle:@"Windows" action:action keyEquivalent:@""]; + [menu addItemWithTitle:@"Services" action:action keyEquivalent:@""]; + [menu addItemWithTitle:@"Hide" action:@selector(hide:) keyEquivalent:@"h"]; + [menu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"]; + + info = [[[NSMenu alloc] init] autorelease]; + [menu setSubmenu:info forItem:[menu itemWithTitle:@"Info"]]; + [info addItemWithTitle:@"Info Panel..." action:@selector(showInfoPanel:) keyEquivalent:@""]; + [info addItemWithTitle:@"Preferences" action:@selector(showPrefPanel:) keyEquivalent:@""]; + [info addItemWithTitle:@"Help" action:action keyEquivalent:@"?"]; + + edit = [[[NSMenu alloc] init] autorelease]; + [edit addItemWithTitle:@"Cut" action:action keyEquivalent:@"x"]; + [edit addItemWithTitle:@"Copy" action:action keyEquivalent:@"c"]; + [edit addItemWithTitle:@"Paste" action:action keyEquivalent:@"v"]; + [edit addItemWithTitle:@"Delete" action:action keyEquivalent:@""]; + [edit addItemWithTitle:@"Select All" action:action keyEquivalent:@"a"]; + [menu setSubmenu:edit forItem:[menu itemWithTitle:@"Edit"]]; + + windows = [[[NSMenu alloc] init] autorelease]; + [windows addItemWithTitle:@"Arrange" + action:@selector(arrangeInFront:) + keyEquivalent:@""]; + [windows addItemWithTitle:@"Miniaturize" + action:@selector(performMiniaturize:) + keyEquivalent:@"m"]; + [windows addItemWithTitle:@"Close" + action:@selector(performClose:) + keyEquivalent:@"w"]; + [menu setSubmenu:windows forItem:[menu itemWithTitle:@"Windows"]]; + + services = [[[NSMenu alloc] init] autorelease]; + [menu setSubmenu:services forItem:[menu itemWithTitle:@"Services"]]; + + [[NSApplication sharedApplication] setMainMenu:menu]; + [[NSApplication sharedApplication] setServicesMenu: services]; + + [menu update]; + [menu display]; +} + + +