ftp.nice.ch/pub/next/tools/workspace/DockPrint.s.tar.gz#/UtilityObject.m

This is UtilityObject.m in view mode; [Download] [Up]

/* Generated by Interface Builder */
#import <appkit/graphics.h>
#import <appkit/publicWraps.h>
#import <appkit/Application.h>
#import <appkit/Listener.h>
#import <appkit/Speaker.h>
#import <appkit/Window.h>
#import <appkit/TextField.h>
#import <appkit/Panel.h>
#import "UtilityObject.h"

@implementation UtilityObject

-appDidInit:sender
{
	unsigned int wn;
	id speaker = [NXApp appSpeaker];
	
        NXConvertWinNumToGlobal([[NXApp appIcon] windowNum], &wn);
	[speaker setSendPort:
	 		NXPortFromName(NX_WORKSPACEREQUEST, NULL)];
        [speaker registerWindow:wn 
		toPort:[[NXApp appListener] listenPort]];
	
        return self;
}

- (int)iconEntered:(int)windowNum at:(double)x :(double)y
    iconWindow:(int)iconWindowNum 
    iconX:(double)iconX iconY:(double)iconY
    iconWidth:(double)iconWidth 
    iconHeight:(double)iconHeight
    pathList:(char *)pathList
{
    if (!iconPathList || strcmp(iconPathList, pathList)) {
        NX_FREE(iconPathList);
        NX_MALLOC(iconPathList, char, strlen(pathList)+1);
        strcpy(iconPathList, pathList);
    }
        
    return 0;
}

- (int)iconReleasedAt:(double)x :(double)y ok:(int *)flag
{
    char *file;
    char command[128];
    int which;
    
    NX_DURING
        file = iconPathList;
        [NXApp activateSelf:YES];
	if (file[strlen(file)-1] == 'Z')
	{
	   if (NXRunAlertPanel(file, 
	   	"File is of type .Z : Uncompresss?",
	   	"Uncompress", "Cancel",NULL) != 0)
		{
		    sprintf(command,"uncompress %s",file);
		    system(command);
		}
        }
	else if ((strlen(file) > 3) &&
		 (file[strlen(file)-1] == 'r') &&
 		 (file[strlen(file)-2] == 'a') &&
 		 (file[strlen(file)-3] == 't'))
	{
	   if (NXRunAlertPanel(file, 
	   	"File is of type .tar : Untar?",
	   	"Untar", "Cancel",NULL) != 0)
		{
		    sprintf(command,"tar xf %s",file);
		    system(command);
		}
        }
	else if ((which = NXRunAlertPanel(file, 
			"Do you wish to Print?",
	   		"Print", "Cancel", "Compress")) != 0)
	{
	     if (which == -1)
	     {
	     	 sprintf(command, "compress %s",file);
		 system(command);
	     }
	     else 
	     if (which == 1)
	     {
	         sprintf(command, "lpr %s", file);
		 system(command);
	     }
	}
    NX_HANDLER
    NX_ENDHANDLER
    *flag = YES;

    return 0;
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.