This is DirController.m in view mode; [Download] [Up]
//============================================================================= // // Copyright (C) 1995-1997 by Paul S. McCarthy and Eric Sunshine. // Written by Paul S. McCarthy and Eric Sunshine. // All Rights Reserved. // // This notice may not be removed from this source code. // // This object is included in the MiscKit by permission from the authors // and its use is governed by the MiscKit license, found in the file // "License.rtf" in the MiscKit distribution. Please refer to that file // for a list of all applicable permissions and restrictions. // //============================================================================= //----------------------------------------------------------------------------- // DirController.m // // Manages application which demonstrates use of TableScroll. // //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // $Id: DirController.m,v 1.1 97/02/05 08:23:02 sunshine Exp $ // $Log: DirController.m,v $ // Revision 1.1 97/02/05 08:23:02 sunshine // v13: Synchronized with ScrollDir (v29). // //----------------------------------------------------------------------------- #import "DirController.h" #import "DirWindow.h" #import "SD_PageLayout.h" #import <string.h> #import <appkit/Application.h> #import <appkit/OpenPanel.h> #import <appkit/Text.h> #import <objc/NXBundle.h> @implementation DirController //----------------------------------------------------------------------------- // - init //----------------------------------------------------------------------------- - (id)init { [super init]; infoPanel = 0; return self; } //----------------------------------------------------------------------------- // - free //----------------------------------------------------------------------------- - (id)free { if (infoPanel) [infoPanel free]; return [super free]; } //----------------------------------------------------------------------------- // - appWillInit: //----------------------------------------------------------------------------- - (id)appWillInit:(id)sender { [SD_PageLayout new]; return self; } //----------------------------------------------------------------------------- // - appDidInit: //----------------------------------------------------------------------------- - (id)appDidInit:(id)sender { [DirWindow launchDir:0]; return self; } //----------------------------------------------------------------------------- // - new: //----------------------------------------------------------------------------- - (id)new:(id)sender { int rc; OpenPanel* panel = [OpenPanel new]; [panel setTitle:"Open Directory"]; [panel setPrompt:"Directory:"]; [panel chooseDirectories:YES]; [panel allowMultipleFiles:NO]; // OpenPanel screws up multiple dirs. [panel setTreatsFilePackagesAsDirectories:YES]; rc = [panel runModal]; [panel close]; if (rc == NX_OKTAG) { char const* const* filename; char const* dir = [panel directory]; if (dir == 0) dir = ""; for (filename = [panel filenames]; *filename != 0; filename++) { char buff[ FILENAME_MAX * 2 + 1 ]; strcat( strcat( strcpy( buff, dir ), "/" ), *filename ); [DirWindow launchDir:buff]; } } return self; } //----------------------------------------------------------------------------- // - info: //----------------------------------------------------------------------------- - (id)info:(id)sender { if (infoPanel == 0) { char buff[ FILENAME_MAX + 1 ]; id const bundle = [NXBundle bundleForClass:[self class]]; [bundle getPath:buff forResource:"Info" ofType:"nib"]; [NXApp loadNibFile:buff owner:self withNames:NO fromZone:[self zone]]; if (![bundle getPath:buff forResource:"README" ofType:"rtf"]) [bundle getPath:buff forResource:"README" ofType:"rtfd"]; [infoText openRTFDFrom:buff]; } [infoPanel makeKeyAndOrderFront:self]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.