ftp.nice.ch/pub/next/connectivity/protocol/GateKeeper.3.0.Beta.4.s.tar.gz#/GateKeeper.3.0.Beta.4.s/Select.bproj/SelectPanelController.m

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

//*****************************************************************************
//
//	PanelController.h.  
//
//		Preferences logic.
//
//			by	Felipe A. Rodriguez		
//
//	This code is supplied "as is" the author makes no warranty as to its 
//	suitability for any purpose.  This code is free and may be distributed 
//	in accordance with the terms of the:
//		
//			GNU GENERAL PUBLIC LICENSE
//			Version 2, June 1991
//			copyright (C) 1989, 1991 Free Software Foundation, Inc.
// 			675 Mass Ave, Cambridge, MA 02139, USA
//
//*****************************************************************************

#import "SelectPanelController.h"
#import "../Coordinator.h"
#import "../DLDelegate.h"


 

@implementation SelectPanelController

//*****************************************************************************
//
//		sent to us after nib objects are unarchived and init'd 
//
//*****************************************************************************
 
- awakeFromNib
{
	[[[[[[[[DLBrowser setTitled:NO] 		// create and configure nxbrowser
					setHorizontalScrollButtonsEnabled:NO]
					setDelegate:[[NXApp delegate] docLDelegate]]
					setTarget:[[NXApp delegate] docLDelegate]]
					setAction:@selector(browserHit:)]
					setDoubleAction:@selector(browserDoubleClick:)]
					setMinColumnWidth:200]
					setMaxVisibleColumns:1];

    [DLPathField setStringValue:NXGetDefaultValue([NXApp appName], LIBPATH)];
	[self initDList];										// load browser

    return self;
}
//*****************************************************************************
//
// 		initialize the hotlist and reinit if path to it is changed 
//
//*****************************************************************************

- initDList 
{
char *sC;
id DList = [[DLBrowser delegate] DList];

				//	cell selection in hotList should persist between sessions
				//	so recall previous selection
	sC = NXCopyStringBuffer(NXGetDefaultValue([NXApp appName],SELCELL));		
	selCell = atoi(sC);
	free(sC);
	[DLBrowser loadColumnZero];		// NXBrowser s/load cols from its delegate
	if([DList count] > 0)			// if hotList path is valid
		{
		mat = [DLBrowser matrixInColumn:0];		
		[DLBrowser useScrollButtons:NO];		
		if(!(selCell < [DList count]))
			selCell = 0;
		if(selCell < [DList count])
			{
			[mat selectCellAt:selCell :0];
			[mat scrollCellToVisible:selCell :0];
			}
		}													

	return self;
}
//*****************************************************************************
//
//		document directory path changed
//
//*****************************************************************************
 
- setDListPath:sender
{				// write an entry to defaults database
	if(!NXWriteDefault([NXApp appName], LIBPATH, [sender stringValue]))
		[[NXApp delegate] showAlert:"ddbWriteError"];
	[self resetDLBrowser];

    return self; 
}
//*****************************************************************************
//
//		select a document List path
//
//*****************************************************************************
 
- selectDListPath:sender
{				
id	theOpenPanel;   
const char *filter[2] = {"Gate", NULL};		// filter for Gate doc path's

	theOpenPanel = [OpenPanel new];
	[theOpenPanel setTitle:"Documents"];
	if(NX_OKTAG == [theOpenPanel runModalForDirectory:
						NXGetDefaultValue([NXApp appName], LIBPATH) file:NULL 	
						types:filter])
		{
		if(!NXWriteDefault([NXApp appName], LIBPATH, [theOpenPanel directory]))
			[[NXApp delegate] showAlert:"ddbWriteError"];
		[DLPathField setStringValue:[theOpenPanel directory]];
		[self resetDLBrowser];
		}

    return self;
}
//*****************************************************************************
//
//		reset preferences document List browswer
//
//*****************************************************************************
 
- resetDLBrowser
{						
	[DLBrowser loadColumnZero];		// NXBrowser s/load cols from its delegate
	[[[NXApp delegate] docLDelegate] initDList];
	mat = [DLBrowser matrixInColumn:0];
	[mat selectCellAt:[[[NXApp delegate] docLDelegate] hLSelectedCell]:0];

    return self;
}
//*****************************************************************************
//
//		returns the inspector panel we control
//
//*****************************************************************************

- inspectorPanel
{
    return 	[DLPathField window];
}

@end

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