This is HipsApp.m in view mode; [Download] [Up]
/*
Copyright Notice:
Copyright 1990 Robert C. Hood
This software is distributed "as is" without warranty. Use this software at your OWN RISK. Source may be distributed freely, at NO CHARGE, but must be accompanied by this documentation and copyright notice.
*/
#import "HipsApp.h"
#include "HipsImage.h"
#include "HipsView.h"
id infopanel, myapp, mainmenu, openpanel;
/**
**
** IMPLEMENTATION SECTION
**
**/
@implementation Myapp : Application
{
}
+new
{
self = [super new];
[self activateSelf: NO];
}
-(BOOL)appAcceptsAnotherFile:sender
{
return YES;
}
-openfile:sender
{
char fullPath [500];
char file[500];
char *opentypes[2] = {"hips",NULL};
id hipsView;
int loop;
if([openpanel runModalForTypes:opentypes]) {
loop = 0;
while ([openpanel filenames] [loop]) {
strcpy (fullPath, [openpanel directory]);
strcat (fullPath, "/");
strcpy (file, [openpanel filenames] [loop]);
strcat (fullPath, file);
hipsView = [HipsView new];
[hipsView open:(char *)fullPath file: (char *)file];
++loop;
}
}
}
-info:sender
{
[infopanel orderFront: self];
[infopanel becomeKeyWindow];
}
@end
setUp()
{
id id1, id2, font, text;
id filesubmenu, fileID;
NXRect temp;
/* Open Panel */
openpanel = [OpenPanel new];
[openpanel allowMultipleFiles: YES];
/* Info Panel */
NXSetRect (&temp, 200.0, 600.0, 340.0, 125.0);
infopanel = [Panel newContent: &temp
style: NX_TITLEDSTYLE
backing: NX_RETAINED
buttonMask: NX_CLOSEBUTTONMASK
defer: NO];
[infopanel setHideOnDeactivate: NO];
[infopanel setTitle: "Info"];
NXSetRect (&temp, 25.0, 25.0, 80.0, 80.0);
id2 = [View new];
[[infopanel setContentView: id2] free];
id1 = [Button newFrame: &temp
icon: "app"
tag: 1
target: nil
action: nil
key: 0
enabled: NO];
[id2 addSubview: id1];
/* NeXTHips */
font = [Font newFont: "Times-Bold" size: 30.0];
text = [Text setDefaultFont: font];
NXSetRect (&temp, 120.0, 0.0, 250.0, 110.0);
id1 = [Text newFrame: &temp
text: "NeXTHips"
alignment: NX_LEFTALIGNED];
[id1 setEditable: NO];
[id1 setSelectable: NO];
[id2 addSubview: id1];
/* By Robert Hood && Andrew Duchowski */
font = [Font newFont: "Times-Roman" size: 12.0];
text = [Text setDefaultFont: font];
NXSetRect (&temp, 120.0, 0.0, 250.0, 75.0);
id1 = [Text newFrame: &temp
text: "By Robert Hood && Andrew Duchowski"
alignment: NX_LEFTALIGNED];
[id1 setEditable: NO];
[id1 setSelectable: NO];
[id1 setTextGray: 1.0];
[id2 addSubview: id1];
/* Version and copyright */
font = [Font newFont: "Times-Italic" size: 12.0];
text = [Text setDefaultFont: font];
NXSetRect (&temp, 120.0, 0.0, 250.0, 58.0);
id1 = [Text newFrame: &temp
text: "Version 1.0\nCopyright 1990 Robert C. Hood && Andrew Duchowski"
alignment: NX_LEFTALIGNED];
[id1 setEditable: NO];
[id1 setSelectable: NO];
[id1 setTextGray: NX_DKGRAY];
[id2 addSubview: id1];
[infopanel display];
/* File operations menu */
filesubmenu = [Menu newTitle: "File"];
[[filesubmenu addItem: "Open"
action: @selector (openfile:)
keyEquivalent: 'o']
setTarget: myapp];
[filesubmenu display];
/* Main menu */
mainmenu = [Menu newTitle: "Hips"];
[[mainmenu addItem: "Info..."
action: @selector (info:)
keyEquivalent: 0] setTarget : myapp];
[mainmenu setSubmenu: filesubmenu
forItem: [mainmenu addItem: "File"
action: 0
keyEquivalent: 0]];
[mainmenu addItem: "Hide"
action: @selector (hide:)
keyEquivalent: 'h'];
[mainmenu addItem: "Quit"
action: @selector (terminate:)
keyEquivalent: 'q'];
[mainmenu display];
[NXApp setMainMenu: mainmenu];
}
main ()
{
[Myapp new];
setUp();
[NXApp run];
[NXApp free];
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.