ftp.nice.ch/pub/next/tools/frontends/Gnuplot.I.bs.tar.gz#/Gnuplot/GnuplotSource/OptionsPanel.m

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

/*
 *  Copyright (C) 1993  Robert Davis
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of Version 2, or any later version, of 
 *  the GNU General Public License as published by the Free Software 
 *  Foundation.
 */


static char RCSId[]="$Id: OptionsPanel.m,v 1.9 1993/05/18 03:55:27 davis Exp $";


#import <appkit/Application.h>
#import <appkit/Cell.h>
#import <appkit/Matrix.h>
#import <appkit/Panel.h>
#import <appkit/Text.h>

#import "Gnuplot.h"
#import "GnuplotPlot.h"
#import "OptionsPanel.h"


@interface OptionsPanel (Private)

- _updatePanel;

@end


@implementation OptionsPanel

- init
{
    [super init];
    return self;
}


- free
{
    [panel free];
    return [super free];
}


- panel
{
    return panel;
}



- showPanel:sender
{
    [panel orderFront:self];
    return self;
}


- forceUpdate
{
    id mainWindow = [NXApp mainWindow];

    if (mainWindow)
	status = [[mainWindow delegate] status];
    else
	status = nil;

    [self _updatePanel];

    return self;
}


- windowDidUpdate:sender
{
    id		mainWindow = [NXApp mainWindow];
    Status	*newStatus;

    if (mainWindow)
	newStatus = [[mainWindow delegate] status];
    else {
	id	doc;
	if (doc = [[NXApp delegate] currentDoc])
	    newStatus = [doc status];
	else
	    newStatus = nil;
    }

    if (newStatus != status) {
	status = newStatus;
	[self _updatePanel];
    }

    return self;
}


// Shuts up the compiler about unused RCSId
- (const char *) rcsid
{
    return RCSId;
}



- textDidEnd:textObject endChar:(unsigned short)whyEnd
{
    /*  
     *  Normally, a text-based control's action is sent only when 
     *  editting ends with a Return.  We use this method to send the 
     *  action on Tab and Backtab, too.
     */

    if (_textChanged && ((whyEnd == NX_TAB) || (whyEnd == NX_BACKTAB)))  {

	id	control = [textObject delegate];
	Cell	*editCell;

	/*  
	 *  If the Control is a Matrix, we check to see if the Cell 
	 *  being edited has an action, in which case we send it to 
	 *  the Cell's target.  Otherwise send the Control's action to 
	 *  the Control's target.
	 */
	
	if ([control isKindOf:[Matrix class]] &&
	    [(editCell = [control selectedCell]) action])

	    [[editCell controlView] sendAction:[editCell action]
					    to:[editCell target]];

	else			/* Otherwise, do the control's action	*/

	    [control sendAction:[control action] to:[control target]];

    }

    _textChanged = NO;

    return self;
}



- (BOOL) textWillChange:textObject
{
    _textChanged = YES;
    return NO;		/* NO means it's okay for the text to change	*/
}



@end






@implementation OptionsPanel (Private)


- _updatePanel
{
    return self;
}


@end

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