% Installer: "presto_install.m"
% Created: 31-May-2002 09:37:55.

function bund_driver

% bund_driver -- Driver for "bund" bundles.
%  bund_driver (no arguments) contains Matlab commands
%   to inflate the instructions and files that are
%   encoded into the "bund_data" function of this package.
 
% Copyright (C) 2001 Dr. Charles R. Denham, ZYDECO.
%  All Rights Reserved.
%   Disclosure without explicit written consent from the
%    copyright owner does not constitute publication.
 
% Version of 14-Jun-2001 10:54:16.
% Updated    03-Aug-2001 13:43:17.

help(mfilename)

BINARY_TAG = '?';

CR = char(13);
LF = char(10);

comp = upper(computer);
if any(findstr(comp, 'PCWIN'))   % Windows.
	NL = [CR LF];
elseif any(findstr(comp, 'MAC2'))   % Macintosh.
	NL = CR;
else   % Unix.
	NL = LF;
end

c = zeros(1, 256);
c(abs('0'):abs('9')) = 0:9;
c(abs('a'):abs('f')) = 10:15;

disp([' '])
disp([' ## This installer is ready to expand its contents,'])
disp([' ## starting in the present directory: "' pwd '"'])
disp([' ## To abort, execute an interruption now.'])
disp([' ## Otherwise, to continue, press any key.'])
disp([' '])

try
	pause
catch
	disp([' ## Installation interrupted.'])
	disp([' '])
	return
end

tic

w = which(mfilename);

fin = fopen(w, 'r');
if fin < 0, return, end

found = ~~0;
while ~found
	s = fgetl(fin);
	if isequal(s, -1)
		fclose(fin);
		return
	end
	s = strrep(s, LF, '');  % Not necessary?
	s = strrep(s, CR, '');  % Not necessary?
	if isequal(s, 'function bund_data')
		found = ~~1;
	end
end

fout = -1;

done = ~~0;
while ~done
	s = fgetl(fin);
	if isequal(s, -1)
		fclose(fin);
		return
	end
	if length(s) > 0
		if s(1) ~= '%'
			f = findstr(s, 'bund_setdir');
			if any(f)
				theDir = eval(strrep(s, 'bund_setdir', ''));
				status = mkdir(theDir);
				switch status
				case 1
					disp([' ## Directory created: "' theDir '"'])
				case 2
					disp([' ## Directory exists: "' theDir '"'])
				otherwise
					error([' ## Error while making new directory.'])
				end
				
				try
					cd(theDir)
				catch
					error([' ## Unable to go to directory: "' theDir '"'])
				end
			else
				try
					eval(s);
				catch
					error([' ## Unable to evaluate: "' s '"'])
				end
			end
		elseif length(s) > 1 & s(2) == BINARY_TAG
			hx = double(s(3:end));   % Assume hex data.
			bin = 16*c(hx(1:2:end)) + c(hx(2:2:end));
			fwrite(fout, bin, 'uchar');
		else
			fprintf(fout, '%s', s(2:end));
			fprintf(fout, NL);
		end
	end
end

fclose(fin);

disp([' ## Elapsed time: ' num2str(fix(10*toc)/10) ' s.'])

function bund_data
bund_setdir('presto')
bund_setdir('@presto')

disp(' ## Installing: "detach.m" (text)')
fout = fopen('detach.m', 'w');
%function theResult = detach(self)
%
%% presto/detach -- Remove "presto" object from handle.
%%  detach(self) removes self, a "presto" object, from
%%   its associated handle.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 01-Nov-1999 10:45:28.
%% Updated    01-Nov-1999 10:45:28.
%
%if nargout > 0, theResult = presto(self); end
%if nargin < 1, help(mfilename), return, end
%
%set(handle(self), 'UserData', self.UserData)
fclose(fout);

disp(' ## Installing: "disp.m" (text)')
fout = fopen('disp.m', 'w');
%function theResult = disp(self, verboseFlag)
%
%% presto/display -- Display "presto" object.
%%  display(self, verboseFlag) displays the contents
%%   of self, a "presto" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 28-Oct-1999 02:51:45.
%% Updated    28-Oct-1999 02:51:45.
%
%if nargin < 1, help(mfilename), return, end
%if nargin < 2, verboseFlag = 0; end
%
%disp(struct(self))
%
%if any(verboseFlag)
%	disp(self.itsData)
%end
fclose(fout);

disp(' ## Installing: "display.m" (text)')
fout = fopen('display.m', 'w');
%function theResult = display(self, verboseFlag)
%
%% presto/display -- Display "presto" object.
%%  display(self, verboseFlag) displays the contents
%%   of self, a "presto" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 28-Oct-1999 02:51:45.
%% Updated    28-Oct-1999 02:51:45.
%
%if nargin < 1, help(mfilename), return, end
%if nargin < 2, verboseFlag = 0; end
%
%disp(' ')
%disp([inputname(1) ' ='])
%disp(' ')
%disp(self, verboseFlag)
fclose(fout);

disp(' ## Installing: "doabout.m" (text)')
fout = fopen('doabout.m', 'w');
%function doabout(self)
%
%%    The "presto" class provides a framework for
%% processing interactive graphical events.  It
%% features "dot" syntax for the setting/getting
%% of graphical and user-defined properties.  All
%% events are trapped by calls to "event", whose
%% sole argument is the name of Matlab callback
%% (e.g. "ButtonDownFcn").  Use "menu" to add
%% menu items, "control" to add controls, and
%% "enable" to automatically enable the relevant
%% callbacks.  The file "presto_test.m" gives a
%% demonstration.
%%    The "presto" class should be super-classed,
%% and the "event" method should be overloaded.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 01-Nov-1999 13:53:56.
%% Updated    04-Nov-1999 15:56:44.
%
%helpdlg(help(mfilename), 'About Presto')
fclose(fout);

disp(' ## Installing: "doclear.m" (text)')
fout = fopen('doclear.m', 'w');
%function theResult = doclear(self, varargin)
%
%% presto/doclear -- Stub for "clear" event.
%%  doclear(self) returns self.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:18:31.
%% Updated    02-Nov-1999 23:18:31.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "docontrol.m" (text)')
fout = fopen('docontrol.m', 'w');
%function theResult = docontrol(self, theEvent, varargin)
%
%% presto/docontrol -- Handler for "presto" controls.
%%  docontrol(self, 'theEvent') handles 'theEvent' on
%%   behalf of self, a "presto" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 11:49:51.
%% Updated    05-Nov-1999 15:00:06.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%switch theEvent
%case {'bottom', 'right', 'top', 'left'}
%	theValue = get(gcbo, 'Value');
%	theMin = get(gcbo, 'Min');
%	theMax = get(gcbo, 'Max');
%	disp([' ## ' theEvent ' ' mat2str([theMin theValue theMax])])
%otherwise
%	theValue = get(gcbo, 'Value');
%	disp([' ## ' theEvent mat2str(theValue)])
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "docopy.m" (text)')
fout = fopen('docopy.m', 'w');
%function theResult = docopy(self, varargin)
%
%% presto/docopy -- Stub for "copy" event.
%%  docopy(self) returns self.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:18:31.
%% Updated    02-Nov-1999 23:18:31.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "docut.m" (text)')
fout = fopen('docut.m', 'w');
%function theResult = docut(self, varargin)
%
%% presto/docut -- Stub for "cut" event.
%%  docut(self) returns self.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:18:31.
%% Updated    02-Nov-1999 23:18:31.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "doedit.m" (text)')
fout = fopen('doedit.m', 'w');
%function theResult = doedit(self, varargin)
%
%% presto/doedit -- Stub for "edit" event.
%%  doedit(self) returns self.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:18:31.
%% Updated    02-Nov-1999 23:18:31.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "doevent.m" (text)')
fout = fopen('doevent.m', 'w');
%function theResult = doevent(self, theEvent, theMessage, varargin)
%
%% presto/doevent -- Call "presto" event handler.
%%  doevent(self, theEvent, theMessage) calls the appropriate
%%   event handler on behalf of self, a "presto" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 19:28:46.
%% Updated    08-Dec-1999 11:47:11.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%if nargin < 2, theEvent = '(none)'; end
%if nargin < 3, theMessage = []; end
%
%result = [];
%
%switch get(gcbo, 'Type')
%case 'uimenu*'
%	result = domenu(self, theEvent, theMessage);
%case 'uicontrol*'
%	result = docontrol(self, theEvent, theMessage);
%otherwise
%	theHandler = handler(self, theEvent);
%	if ~isempty(theHandler)
%		result = builtin('feval', theHandler, self, theEvent, theMessage);
%	else
%		if isempty(theEvent), theEvent = '(none)'; end
%		theType = get(gcbo, 'Type');
%		disp([' ## ' datestr(now, 13) ' ' theEvent ' ' theType ' ' num2str(gcbo)])
%	end
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "dofile.m" (text)')
fout = fopen('dofile.m', 'w');
%function theResult = dofile(self, varargin)
%
%% presto/dofile -- Stub for "file" event.
%%  dofile(self) returns self.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:18:31.
%% Updated    02-Nov-1999 23:18:31.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "domenu.m" (text)')
fout = fopen('domenu.m', 'w');
%function theResult = domenu(self, theEvent, varargin)
%
%% presto/domenu -- Handler for "presto" menus.
%%  domenu(self, 'theEvent') handles 'theEvent' on
%%   behalf of self, a "presto" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 11:49:51.
%% Updated    05-Nov-1999 15:00:06.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%try
%	theHandler = handler(self, theEvent);
%	result = builtin('feval', theHandler, self, theEvent);
%catch
%	errormsg(self)
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "domenubar.m" (text)')
fout = fopen('domenubar.m', 'w');
%function theResult = domenubar(self, varargin)
%
%% presto/domenubar -- Toggle the "presto" menubar.
%%  domenubar(self) toggles the menubar on behalf
%%   of self, a "presto" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 04-Nov-1999 15:32:53.
%% Updated    04-Nov-1999 15:32:53.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theMenu = gcbo;
%
%theFigure = theMenu;
%while ~isequal(get(theFigure, 'Type'), 'figure')
%	theFigure = get(theFigure, 'Parent');
%end
%
%switch lower(get(theFigure, 'MenuBar'))
%case 'figure'
%	set(theFigure, 'MenuBar', 'none')
%	if any(theMenu), set(theMenu, 'Checked', 'off'); end
%case 'none'
%	set(theFigure, 'MenuBar', 'figure')
%	if any(theMenu), set(theMenu, 'Checked', 'on'); end
%end
%
%if nargout > 0, theResult = self; end
fclose(fout);

disp(' ## Installing: "domouse.m" (text)')
fout = fopen('domouse.m', 'w');
%function theResult = domouse(self, theEvent, varargin)
%
%% presto/domouse -- Process "presto" mouse events.
%%  domouse(self, 'theEvent') handles mouse events
%%   on behalf of self, a "presto" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 08:43:30.
%% Updated    05-Nov-1999 08:43:30.
%
%persistent OLD_NAME
%persistent OLD_NUMBER_TITLE
%persistent OLD_POINTER
%persistent SELECTION_TYPE
%
%switch theEvent
%
%% Mouse play.
%	
%case 'windowbuttonmotionfcn'
%	pt = get(gca, 'CurrentPoint');
%	pt = mean(pt);
%	NEW_NAME = ['[' num2str(pt(1)) ', ' num2str(pt(2)) ', ' num2str(pt(3)) ']'];
%	set(gcbf, 'Name', NEW_NAME)
%case 'windowbuttondownfcn'
%	pt = get(gca, 'CurrentPoint');
%	pt = mean(pt);
%	SELECTION_TYPE = get(gcbf, 'SelectionType');
%	NEW_NAME = ['[' num2str(pt(1)) ', ' num2str(pt(2)) ', ' num2str(pt(3)) ']'];
%	NEW_NUMBER_TITLE = 'off';
%	NEW_POINTER = 'circle';
%	OLD_NAME = get(gcbf, 'Name');
%	OLD_NUMBER_TITLE = get(gcbf, 'NumberTitle');
%	OLD_POINTER = get(gcbf, 'Pointer');
%	set(gcbf, ...
%			'WindowButtonDownFcn', '', ...
%			'WindowButtonMotionFcn', ['event WindowButtonMotionFcn'], ...
%			'WindowButtonUpFcn', ['event WindowButtonUpFcn'], ...
%			'Name', NEW_NAME, 'NumberTitle', NEW_NUMBER_TITLE, ...
%			'Pointer', NEW_POINTER);
%case 'windowbuttonupfcn'
%	set(gcbf, ...
%			'WindowButtonMotionFcn', '', ...
%			'WindowButtonUpFcn', '', ...
%			'WindowButtonDownFcn', ['event WindowButtonDownFcn'], ...
%			'Name', OLD_NAME, 'NumberTitle', OLD_NUMBER_TITLE, ...
%			'Pointer', OLD_POINTER);
%	OLD_NAME = [];
%	OLD_POINTER = [];
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "donew.m" (text)')
fout = fopen('donew.m', 'w');
%function theResult = donew(self, varargin)
%
%% presto/donew -- Stub for "new" event.
%%  donew(self) returns self.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:18:31.
%% Updated    02-Nov-1999 23:18:31.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "doopen.m" (text)')
fout = fopen('doopen.m', 'w');
%function theResult = doopen(self, varargin)
%
%% presto/doopen -- Open a file.
%%  doopen(self) opens and reads the contents of self,
%%   a "presto" object, from theFile.  If no filename
%%   is given, the "uigetfile" dialog is invoked.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 01-Nov-1999 12:54:50.
%% Updated    01-Nov-1999 12:54:50.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theFile = '*';
%if length(varargin) > 1 & ~isequal(varargin{1}, 'open')
%	theFile = varargin{1};
%else
%	theFile = getfile(self);
%end
%
%try
%	load(theFile)
%	self = setps(self, 'itsSavedFile', theFile);
%catch
%	errormsg(self)
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "dopagesetup.m" (text)')
fout = fopen('dopagesetup.m', 'w');
%function theResult = dopagesetup(self, varargin)
%
%% presto/dopagesetup -- Stub for "pagesetup" event.
%%  dopagesetup(self) returns self.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:17:00.
%% Updated    02-Nov-1999 23:17:00.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%try
%	print -v
%catch
%	disp(' ## ' lasterr)
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "dopaste.m" (text)')
fout = fopen('dopaste.m', 'w');
%function theResult = dopaste(self, varargin)
%
%% presto/dopaste -- Stub for "paste" event.
%%  dopaste(self) returns self.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:18:31.
%% Updated    02-Nov-1999 23:18:31.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "doprint.m" (text)')
fout = fopen('doprint.m', 'w');
%function theResult = doprint(self, varargin)
%
%% presto/doprint -- Print "presto" figure.
%%  doprint(self) prints the figure associated
%%   with self, a "presto" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:17:00.
%% Updated    02-Nov-1999 23:17:00.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%try
%	eval(['print -v -noui -f' int2str(gcbf)])
%catch
%	disp([' ## ' lasterr])
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "doquit.m" (text)')
fout = fopen('doquit.m', 'w');
%function theResult = doquit(self, varargin)
%
%% presto/doquit -- Quit a "proxy" process.
%%  doquit(self) deletes the handle associated
%%   with self, a "presto" object, then returns
%%   the empty-matrix [].
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:18:31.
%% Updated    02-Nov-1999 23:18:31.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%delete(gcbf)
%
%if nargout > 0
%	theResult = [];
%end
fclose(fout);

disp(' ## Installing: "dorevert.m" (text)')
fout = fopen('dorevert.m', 'w');
%function theResult = dorevert(self, varargin)
%
%% presto/dorevert -- Revert to saved file.
%%  dorevert(self) reverts to the saved file
%%   to reset the contents of self.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:17:00.
%% Updated    02-Nov-1999 23:17:00.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theFile = '';
%if isfield(self, 'itsSavedFile')
%	theFile = self.itsSavedFile;
%end
%
%if any(theFile)
%	self = doopen(self, theFile);
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "doroll.m" (text)')
fout = fopen('doroll.m', 'w');
%function theResult = doroll(self, theEvent, theMessage)
%
%% presto/doroll -- Handler for "presto" scrollbars.
%%  doroll(self, theEvent, theMessage) rotates the view
%%   in keeping with the active scrollbars.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 21:34:53.
%% Updated    05-Nov-1999 21:34:53.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theXLim = get(gca, 'XLim');   % bottom scrollbar.
%theYLim = get(gca, 'YLim');   % right scrollbar.
%theZLim = get(gca, 'ZLim');   % left scrollbar.
%theCLim = get(gca, 'CLim');   % top scrollbar.
%
%axis tight
%set(gca, 'CLimMode', 'auto')
%
%[theAzimuth, theElevation] = view;
%
%switch theEvent
%case 'bottom'
%	theXLim = get(gca, 'XLim');
%	smin = get(gcbo, 'Min');
%	smax = get(gcbo, 'Max');
%	value = get(gco, 'Value');
%	frac = value / (smax - smin);
%	theXLim = theXLim + (frac - 0.5)*diff(theXLim);
%	theAzimuth = 360*frac - 180;
%case 'right'
%	theYLim = get(gca, 'YLim');
%	smin = get(gcbo, 'Min');
%	smax = get(gcbo, 'Max');
%	value = get(gco, 'Value');
%	frac = value / (smax - smin);
%	theYLim = theYLim + (frac - 0.5)*diff(theYLim);
%	theElevation = 180*frac - 90;
%case 'left'
%	theZLim = get(gca, 'ZLim');
%	smin = get(gcbo, 'Min');
%	smax = get(gcbo, 'Max');
%	value = get(gco, 'Value');
%	frac = value / (smax - smin);
%	theZLim = theZLim + (frac - 0.5)*diff(theZLim);
%case 'top'
%	theCLim = get(gca, 'CLim');
%	smin = get(gcbo, 'Min');
%	smax = get(gcbo, 'Max');
%	value = get(gco, 'Value');
%	frac = value / (smax - smin);
%	frac = 1 - frac;
%	theCLim = theCLim + (frac - 0.5)*diff(theCLim);
%end
%
%if (0)
%	set(gca, 'XLim', theXLim, 'YLim', theYLim, 'ZLim', theZLim, 'CLim', theCLim)
%else
%	theAzimuth, theElevation
%	view(theAzimuth, theElevation)
%end
%
%if nargout > 0
%	theResult = self;
%else
%	assignin('caller', 'ans', self)
%end
fclose(fout);

disp(' ## Installing: "dosave.m" (text)')
fout = fopen('dosave.m', 'w');
%function theResult = dosave(self, varargin)
%
%% presto/dosave -- Save to a file.
%%  dosave(self, 'theFile') saves the contents of
%%   self to theFile.  If no filename is given,
%%   the "uiputfile" dialog is invoked.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 01-Nov-1999 12:54:50.
%% Updated    05-Nov-1999 09:22:44.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theFile = '*';
%if length(varargin) > 0 & ~isequal(varargin{1}, 'save')
%	theFile = varargin{1};
%else
%	theData = data(self);
%	if isfield(theData, 'itsSavedFile')
%		theFile = self.itsSavedFile;
%	end
%end
%
%if any(theFile == '*')
%	theFile = putfile(self);
%end
%
%try
%	theData = data(self);
%	theMessageBox = msgbox(['Saving to "' theFile '"']);
%	save(theFile, 'theData')
%	pause(1)
%	if ishandle(theMessageBox), delete(theMessageBox), end
%	self = setps(self, itsSavedFile, theFile);
%catch
%	errormsg(self)
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "dosaveas.m" (text)')
fout = fopen('dosaveas.m', 'w');
%function theResult = dosaveas(self, varargin)
%
%% presto/dosaveas -- Save "presto" data.
%%  dosaveas(self) saves the data of self,
%%   a "presto" object, to the chosen file.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:17:00.
%% Updated    02-Nov-1999 23:17:00.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%self = dosave(self, '*');
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "doscribble.m" (text)')
fout = fopen('doscribble.m', 'w');
%function theResult = doscribble(self, theEvent, varargin)
%
%% presto/doscribble -- Process "presto" mouse events.
%%  doscribble(self, 'theEvent') handles mouse events
%%   on behalf of self, a "presto" object.  The mouse
%%   track is temporarily scribbled in the window.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 08:43:30.
%% Updated    14-Dec-1999 16:46:14.
%
%persistent OLD_NAME
%persistent OLD_NUMBER_TITLE
%persistent OLD_POINTER
%persistent SELECTION_TYPE
%
%switch lower(theEvent)
%
%% Mouse play.
%	
%case 'windowbuttonmotionfcn'
%	pt = get(gca, 'CurrentPoint');
%	pt = mean(pt);
%	NEW_NAME = ['[' num2str(pt(1)) ', ' num2str(pt(2)) ', ' num2str(pt(3)) ']'];
%	set(gcbf, 'Name', NEW_NAME)
%	h = findobj(gcbf, 'Type', 'line', 'Tag', 'presto-scribble');
%	if any(h)
%		h = h(1);
%		x = get(h, 'XData');
%		y = get(h, 'YData');
%		x(end+1) = pt(1);
%		y(end+1) = pt(2);
%		while length(x) > 10
%			x(1) = [];
%			y(1) = [];
%		end
%		set(h, 'XData', x, 'YData', y)
%	end
%case 'windowbuttondownfcn'
%	pt = get(gca, 'CurrentPoint');
%	pt = mean(pt);
%	SELECTION_TYPE = get(gcbf, 'SelectionType');
%	NEW_NAME = ['[' num2str(pt(1)) ', ' num2str(pt(2)) ', ' num2str(pt(3)) ']'];
%	NEW_NUMBER_TITLE = 'off';
%	NEW_POINTER = 'circle';
%	OLD_NAME = get(gcbf, 'Name');
%	OLD_NUMBER_TITLE = get(gcbf, 'NumberTitle');
%	OLD_POINTER = get(gcbf, 'Pointer');
%	set(gcbf, ...
%			'WindowButtonDownFcn', '', ...
%			'WindowButtonMotionFcn', ['event WindowButtonMotionFcn'], ...
%			'WindowButtonUpFcn', ['event WindowButtonUpFcn'], ...
%			'Name', NEW_NAME, 'NumberTitle', NEW_NUMBER_TITLE, ...
%			'Pointer', NEW_POINTER);
%	h = line(pt(1), pt(2), 'EraseMode', 'xor', ...
%							'Color', [0 0 0], ...
%							'LineWidth', 3.0, ...
%							'LineStyle', '--', ...
%							'Tag', 'presto-scribble');
%case 'windowbuttonupfcn'
%	set(gcbf, ...
%			'WindowButtonMotionFcn', '', ...
%			'WindowButtonUpFcn', '', ...
%			'WindowButtonDownFcn', ['event WindowButtonDownFcn'], ...
%			'Name', OLD_NAME, 'NumberTitle', OLD_NUMBER_TITLE, ...
%			'Pointer', OLD_POINTER);
%	OLD_NAME = [];
%	OLD_POINTER = [];
%	h = findobj(gcbf, 'Type', 'line', 'Tag', 'presto-scribble');
%	if ishandle(h), delete(h), end
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "doscroll.m" (text)')
fout = fopen('doscroll.m', 'w');
%function theResult = doscroll(self, theEvent, theMessage)
%
%% presto/doscroll -- Handler for "presto" scrollbars.
%%  doscroll(self, theEvent, theMessage) pans the axes
%%   in keeping with the active scrollbars.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 21:34:53.
%% Updated    05-Nov-1999 21:34:53.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theXLim = get(gca, 'XLim');   % bottom scrollbar.
%theYLim = get(gca, 'YLim');   % right scrollbar.
%theZLim = get(gca, 'ZLim');   % left scrollbar.
%theCLim = get(gca, 'CLim');   % top scrollbar.
%
%axis tight
%set(gca, 'CLimMode', 'auto')
%
%switch theEvent
%case 'bottom'
%	theXLim = get(gca, 'XLim');
%	smin = get(gcbo, 'Min');
%	smax = get(gcbo, 'Max');
%	value = get(gco, 'Value');
%	frac = value / (smax - smin);
%	theXLim = theXLim + (frac - 0.5)*diff(theXLim);
%case 'right'
%	theYLim = get(gca, 'YLim');
%	smin = get(gcbo, 'Min');
%	smax = get(gcbo, 'Max');
%	value = get(gco, 'Value');
%	frac = value / (smax - smin);
%	theYLim = theYLim + (frac - 0.5)*diff(theYLim);
%case 'left'
%	theZLim = get(gca, 'ZLim');
%	smin = get(gcbo, 'Min');
%	smax = get(gcbo, 'Max');
%	value = get(gco, 'Value');
%	frac = value / (smax - smin);
%	theZLim = theZLim + (frac - 0.5)*diff(theZLim);
%case 'top'
%	theCLim = get(gca, 'CLim');
%	smin = get(gcbo, 'Min');
%	smax = get(gcbo, 'Max');
%	value = get(gco, 'Value');
%	frac = value / (smax - smin);
%	theCLim = theCLim + (frac - 0.5)*diff(theCLim);
%end
%
%set(gca, 'XLim', theXLim, 'YLim', theYLim, 'ZLim', theZLim, 'CLim', theCLim)
%
%if nargout > 0
%	theResult = self;
%else
%	assignin('caller', 'ans', self)
%end
fclose(fout);

disp(' ## Installing: "doundo.m" (text)')
fout = fopen('doundo.m', 'w');
%function theResult = doundo(self, varargin)
%
%% presto/doundo -- Stub for "undo" event.
%%  doundo(self) returns self.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:18:31.
%% Updated    02-Nov-1999 23:18:31.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "doview.m" (text)')
fout = fopen('doview.m', 'w');
%function theResult = doview(self, varargin)
%
%% presto/view -- Toggle between view(2) and view(3).
%%  view(self) toggles the view of axes associated
%%   with self, a "presto" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 10-Nov-1999 08:17:04.
%% Updated    17-Nov-1999 09:05:37.
%
%if nargout > 0, theResult = []; end
%
%theMenu = gcbo;
%
%v = view;
%if norm(diag(view)) > 1.9
%	view(3)
%	if any(theMenu), set(gcbo, 'Checked', 'on'), end
%else
%	view(2)
%	if any(theMenu), set(gcbo, 'Checked', 'off'), end
%end
%
%if nargout > 0
%	theResult = self;
%else
%	assignin('caller', 'ans', self)
%end
fclose(fout);

disp(' ## Installing: "errormsg.m" (text)')
fout = fopen('errormsg.m', 'w');
%function theResult = errormsg(self, theMessage)
%
%% presto/errormsg -- Error message for "presto".
%%  errormsg(self, 'theMessage') posts a message-box
%%   with the given message (default = lasterr).
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 09:45:13.
%% Updated    05-Nov-1999 09:45:13.
%
%PAUSE_TIME = 3;
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%if nargin < 2, theMessage = lasterr; end
%
%theMessageBox = msgbox(theMessage, 'warn');
%pause(PAUSE_TIME)
%if ishandle(theMessageBox), delete(theMessageBox), end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "getfile.m" (text)')
fout = fopen('getfile.m', 'w');
%function theResult = getfile(self, theFileFilter, thePrompt)
%
%% presto/getfile -- Invoke "uigetfile".
%%  getfile(self, 'theFileFilter', 'thePrompt') invokes the
%%   "uigetfile" dialog for the given file-filter and prompt.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 01-Nov-1999 11:37:30.
%% Updated    01-Nov-1999 11:37:30.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%if nargin < 2, theFileFilter = '*'; end
%if nargin < 3, thePrompt = 'Select Input File'; end
%
%[theFile, thePath] = uigetfile(theFileFilter, thePrompt);
%if ~any(theFile), return, end
%
%if thePath(end) ~= filesep, thePath(end+1) = filesep; end
%result = [thePath theFile];
%
%if nargout > 0
%	theResult = result;
%else
%	assignin('caller', 'ans', result)
%	disp(result)
%end
fclose(fout);

disp(' ## Installing: "help_controls.m copy" (binary)')
fout = fopen('help_controls.m copy', 'w');
%?66756e6374696f6e20746865526573756c74203d2068656c70
%?5f636f6e74726f6c732873656c662c20766172617267696e29
%?0d0d2520202020546865202270726573746f2f636f6e74726f
%?6c22206d6574686f64206164647320636f6e74726f6c732074
%?6f207468650d252070726573746f222077696e646f772e2020
%?5374616e64617264207363726f6c6c62617273206172652069
%?6e646963617465640d2520627920746865206e616d65733a20
%?27626f74746f6d272c20277269676874272c2027746f702c27
%?206f7220276c656674272e0d25204f7468657220636f6e7472
%?6f6c73206172652064656e6f74656420627920746865697220
%?225374796c65222070726f70657274792c0d2520617320696e
%?202770757368627574746f6e272e0d25202020204561636820
%?636f6e74726f6c207265717569726573206120226c61796f75
%?74222c20636f6e73697374696e67206f6620610d25206e6f72
%?6d616c697a65642d706f736974696f6e20616e642061207069
%?78656c2d6f66667365742e202054686520226c61796f757422
%?0d2520696e666f726d6174696f6e2069732075736564206279
%?202270726573746f2f646f726573697a652220746f2061646a
%?7573740d25206561636820636f6e74726f6c207768656e6576
%?6572207468652077696e646f7720697320726573697a65642e
%?0d2520202020546865202270726573746f2f636f6e74726f6c
%?22206d6574686f642072657475726e73207468652068616e64
%?6c65206f660d2520746865206e657720636f6e74726f6c2c20
%?736f2074686174206675727468657220656d62656c6c697368
%?6d656e74732063616e0d25206265206d6164652e0d25202020
%?20536565202268656c702070726573746f2f636f6e74726f6c
%?222e0d200d2520436f70797269676874202843292031393939
%?2044722e20436861726c657320522e2044656e68616d2c205a
%?594445434f2e0d252020416c6c205269676874732052657365
%?727665642e0d25202020446973636c6f737572652077697468
%?6f7574206578706c69636974207772697474656e20636f6e73
%?656e742066726f6d207468650d2520202020636f7079726967
%?6874206f776e657220646f6573206e6f7420636f6e73746974
%?757465207075626c69636174696f6e2e0d200d252056657273
%?696f6e206f662030342d4e6f762d313939392031343a34313a
%?33342e0d2520557064617465642020202030342d4e6f762d31
%?3939392031343a35343a30322e0d0d68203d2068656c70286d
%?66696c656e616d65293b0d68656c70646c6728682c20275072
%?6573746f20436f6e74726f6c7327290d0d6966206e6172676f
%?7574203e20302c20746865526573756c74203d2073656c663b
%?20656e640d
fclose(fout);

disp(' ## Installing: "help_events.m copy" (binary)')
fout = fopen('help_events.m copy', 'w');
%?66756e6374696f6e20746865526573756c74203d2068656c70
%?5f6576656e74732873656c662c20766172617267696e290d0d
%?25202020205768656e657665722061206d6f75736520657665
%?6e74206f6363757273206f6e2061202270726573746f22206f
%?626a6563742c0d2520612063616c6c6261636b207265616469
%?6e6720226576656e74207468654576656e744e616d65222069
%?732065786563757465642c0d25207768657265207468654576
%?656e744e616d652077696c6c20626520736f6d657468696e67
%?206c696b652022427574746f6e446f776e46636e222e0d2520
%?546865202270726573746f2f6576656e7422206d6574686f64
%?20697320726573706f6e7369626c6520666f72207472616e73
%?6c6174696e670d2520746865206576656e7420696e746f2061
%?6e20616374696f6e2e20204576656e74732066726f6d20636f
%?6e74726f6c7320616e64206d656e75730d252061726520636f
%?6e76657274656420746f20746865206e616d65206f66207468
%?652063616c6c6261636b2d6f626a6563742e2020416c6c0d25
%?206576656e747320617265207468656e20636f6e7665727465
%?6420746f206c6f7765722d636173652c206465626c616e6b65
%?642c20616e640d25207472696d6d656420746f20636f6e7369
%?7374206f6e6c79206f6620616c7068616e756d657269632063
%?6861726163746572732e20205468650d2520726573756c7420
%?697320676976656e20746f2061202773776974636822206c61
%?6464657220666f722066696e616c206469737061746368696e
%?672e0d25202020205768656e2061206e657720636c61737320
%?697320646572697665642066726f6d202270726573746f222c
%?206974206d7573740d2520737570706c7920616e2022657665
%?6e7422206d6574686f64206f6620697473206f776e20746f20
%?6f76657272696465207468650d252064656661756c74202270
%?726573746f22206265686176696f722c20617320617070726f
%?7072696174652e2020546f20696e766f6b650d252074686520
%?64656661756c74206265686176696f7220696e206120706172
%?746963756c617220736974756174696f6e2c2063616c6c0d25
%?2022696e68657269742873656c662c20277468654576656e74
%?4e616d652729222e0d2520202020536565202270726573746f
%?2f6576656e74222e0d200d2520436f70797269676874202843
%?2920313939392044722e20436861726c657320522e2044656e
%?68616d2c205a594445434f2e0d252020416c6c205269676874
%?732052657365727665642e0d25202020446973636c6f737572
%?6520776974686f7574206578706c6963697420777269747465
%?6e20636f6e73656e742066726f6d207468650d252020202063
%?6f70797269676874206f776e657220646f6573206e6f742063
%?6f6e73746974757465207075626c69636174696f6e2e0d200d
%?252056657273696f6e206f662030342d4e6f762d3139393920
%?31343a34313a33342e0d252055706461746564202020203034
%?2d4e6f762d313939392031343a35343a30322e0d0d68203d20
%?68656c70286d66696c656e616d65293b0d68656c70646c6728
%?682c202750726573746f204576656e747327290d0d6966206e
%?6172676f7574203e20302c20746865526573756c74203d2073
%?656c663b20656e640d
fclose(fout);

disp(' ## Installing: "help_handlers.m copy" (binary)')
fout = fopen('help_handlers.m copy', 'w');
%?66756e6374696f6e20746865526573756c74203d2068656c70
%?5f68616e646c6572732873656c662c20766172617267696e29
%?0d0d25202020204576656e742d68616e646c65727320617265
%?20726567697374657265642077697468202270726573746f22
%?207573696e67207468650d25202268616e646c657222206d65
%?74686f642c2077686963682072657175697265732074686520
%?6e616d65206f6620616e206576656e742c0d25207375636820
%?617320275072696e74272c20616e6420746865206e616d6520
%?6f662074686520636f72726573706f6e64696e67206d657468
%?6f640d2520746861742077696c6c2068616e646c6520746865
%?206576656e742c20737563682061732027646f7072696e7427
%?2e2020416e79206e756d6265720d25206f66206576656e742f
%?68616e646c65722070616972732063616e20626520706c6163
%?656420696e2074686520617267756d656e74206c6973742c0d
%?2520617320696e202273656c66203d2068616e646c65722873
%?656c662c207468654576656e742c2074686548616e646c6572
%?2c202e2e2e29222e0d252020202048616e646c657273206172
%?6520616c776179732063616c6c656420776974682074687265
%?6520696e70757420617267756d656e74732c0d252061732069
%?6e202273656c66203d20646f7072696e742873656c662c2074
%?68654576656e742c207468654d65737361676529222e0d2520
%?202020536565202270726573746f2f68616e646c6572222e0d
%?200d2520436f70797269676874202843292031393939204472
%?2e20436861726c657320522e2044656e68616d2c205a594445
%?434f2e0d252020416c6c205269676874732052657365727665
%?642e0d25202020446973636c6f7375726520776974686f7574
%?206578706c69636974207772697474656e20636f6e73656e74
%?2066726f6d207468650d2520202020636f7079726967687420
%?6f776e657220646f6573206e6f7420636f6e73746974757465
%?207075626c69636174696f6e2e0d200d252056657273696f6e
%?206f662030342d4e6f762d313939392031343a34313a33342e
%?0d2520557064617465642020202030352d4e6f762d31393939
%?2032303a30383a35302e0d0d68203d2068656c70286d66696c
%?656e616d65293b0d68656c70646c6728682c20275072657374
%?6f2048616e646c65727327290d0d6966206e6172676f757420
%?3e20302c20746865526573756c74203d2073656c663b20656e
%?640d
fclose(fout);

disp(' ## Installing: "help_menus.m copy" (binary)')
fout = fopen('help_menus.m copy', 'w');
%?66756e6374696f6e20746865526573756c74203d2068656c70
%?5f6d656e75732873656c662c20766172617267696e290d0d25
%?20202020546865202270726573746f2f6d656e7522206d6574
%?686f642061646473206d656e757320746f2074686520507265
%?73746f0d25206d656e756261722c207573696e672061206365
%?6c6c2d6172726179206f66207468652064657369726564206d
%?656e75206c6162656c732c0d2520617272616e67656420696e
%?20746f702d646f776e2066617368696f6e2e20205072657065
%?6e64656420746f2065616368206c6162656c0d25206973206f
%?6e6520223e2220666f7220656163682073746167652062656c
%?6f772074686520746f702d6c6576656c206d656e752e0d2520
%?466f72206120736570617261746f722d6c696e652062657477
%?65656e206d656e75732c2075736520222d2220696e20706c61
%?63650d25206f66206f6e65206f662074686520223e22207379
%?6d626f6c732e0d25202020204d656e75732063616c6c202265
%?76656e742043616c6c6261636b22207768656e2073656c6563
%?7465642e2020496e736964650d25202270726573746f2f6576
%?656e74222c20746865206576656e74206973207472616e736c
%?6174656420696e746f20746865206d656e750d25206c616265
%?6c206f662074686520696e7374696761746f722c207468656e
%?2070726f63657373656420696e207468652022737769746368
%?220d25206c61646465722c2061732064657363726962656420
%?696e20746865202248656c702f4576656e747322206d656e75
%?2e0d2520202020536565202268656c702070726573746f2f6d
%?656e75222e0d200d2520436f70797269676874202843292031
%?3939392044722e20436861726c657320522e2044656e68616d
%?2c205a594445434f2e0d252020416c6c205269676874732052
%?657365727665642e0d25202020446973636c6f737572652077
%?6974686f7574206578706c69636974207772697474656e2063
%?6f6e73656e742066726f6d207468650d2520202020636f7079
%?7269676874206f776e657220646f6573206e6f7420636f6e73
%?746974757465207075626c69636174696f6e2e0d200d252056
%?657273696f6e206f662030342d4e6f762d313939392031343a
%?34313a33342e0d2520557064617465642020202030342d4e6f
%?762d313939392031343a35343a30322e0d0d68203d2068656c
%?70286d66696c656e616d65293b0d68656c70646c6728682c20
%?2750726573746f204d656e757327290d0d6966206e6172676f
%?7574203c20312c20746865526573756c74203d2073656c663b
%?20656e640d
fclose(fout);

disp(' ## Installing: "help_subclassing.m copy" (binary)')
fout = fopen('help_subclassing.m copy', 'w');
%?66756e6374696f6e20746865526573756c74203d2068656c70
%?5f737562636c617373696e672873656c662c20766172617267
%?696e290d0d25202020205573657273206f662050726573746f
%?2061726520657870656374656420746f206465726976652074
%?68656972206f776e20636c6173730d252066726f6d20227072
%?6573746f222e2020204f6e65207375636820636c6173732c20
%?22707374222068617320616c7265616479206265656e0d2520
%?6275696c7420617320616e206578616d706c652e2020497420
%?63616e20626520636f7069656420616e642072656e616d6564
%?20746f2073657276650d252061732061206672616d65776f72
%?6b20666f7220746865206465726976656420636c6173732e20
%?20556e6c65737320227073742f6576656e74220d2520697320
%?6d6f6469666965642c20616c6c206576656e74732077696c6c
%?2070617373656420696e7461637420746f202270726573746f
%?222e0d2520202020536565202268656c7020707374222e0d20
%?0d2520436f707972696768742028432920313939392044722e
%?20436861726c657320522e2044656e68616d2c205a59444543
%?4f2e0d252020416c6c20526967687473205265736572766564
%?2e0d25202020446973636c6f7375726520776974686f757420
%?6578706c69636974207772697474656e20636f6e73656e7420
%?66726f6d207468650d2520202020636f70797269676874206f
%?776e657220646f6573206e6f7420636f6e7374697475746520
%?7075626c69636174696f6e2e0d200d252056657273696f6e20
%?6f662030352d4e6f762d313939392032303a34363a33352e0d
%?2520557064617465642020202030352d4e6f762d3139393920
%?32303a34363a33352e0d0d68203d2068656c70286d66696c65
%?6e616d65293b0d68656c70646c6728682c202750726573746f
%?20537562636c617373696e6727290d0d6966206e6172676f75
%?74203e20302c20746865526573756c74203d2073656c663b20
%?656e640d
fclose(fout);

disp(' ## Installing: "help_version.m copy" (binary)')
fout = fopen('help_version.m copy', 'w');
%?66756e6374696f6e20746865526573756c74203d2068656c70
%?5f76657273696f6e2873656c662c20766172617267696e290d
%?0d252070726573746f2f68656c705f76657273696f6e2d2d20
%?53686f77202270726573746f222076657273696f6e2e0d2520
%?2068656c705f76657273696f6e2873656c66292073686f7773
%?207468652076657273696f6e206f66202770726573746f220d
%?2520202063757272656e746c79206163746976652e0d200d25
%?20436f707972696768742028432920313939392044722e2043
%?6861726c657320522e2044656e68616d2c205a594445434f2e
%?0d252020416c6c205269676874732052657365727665642e0d
%?25202020446973636c6f7375726520776974686f7574206578
%?706c69636974207772697474656e20636f6e73656e74206672
%?6f6d207468650d2520202020636f70797269676874206f776e
%?657220646f6573206e6f7420636f6e73746974757465207075
%?626c69636174696f6e2e0d200d252056657273696f6e206f66
%?2030342d4e6f762d313939392031353a31373a32392e0d2520
%?557064617465642020202030342d4e6f762d31393939203135
%?3a31373a32392e0d0d68203d2068656c70282770726573746f
%?2f76657273696f6e27293b0d68656c70646c6728682c202750
%?726573746f2056657273696f6e27290d0d6966206e6172676f
%?7574203c20312c20746865526573756c74203d2073656c663b
%?20656e640d
fclose(fout);

disp(' ## Installing: "presto.m" (text)')
fout = fopen('presto.m', 'w');
%function theResult = presto
%
%% presto/presto -- Constructor for "presto" class.
%%  presto(theHandle) attaches a new "presto" object
%%   to theHandle, which defaults to a new figure.
%%   However, if theHandle already has a "presto"
%%   object, that object is simply returned and
%%   no new object is created.
%%  presto(theHandle) returns the "presto" object
%%   already associated with theHandle.
%%  presto(thePresto) updates the "presto" object
%%   by writing thePresto to its associated handle.
%%
%% Synopsis of Presto
%%
%%    Presto is a class for managing events generated
%% by graphical objects.  Each "presto" object is attached
%% to a Matlab handle.  The properties of the object and
%% of its handle are manipulated in the same manner, using
%% "dot" syntax.  This allows the user to define arbitrary
%% properties in the object, as well as to manipulate the
%% graphical properties of the associated handle easily.
%% Subscripting can be nested, which makes the "presto"
%% syntax more versatile than that used for the Matlab
%% "set" and "get" commands.
%%
%%    Presto preserves any existing "UserData" and allows
%% it to be manipulated via self.UserData.  Special handling
%% takes place where "UserData" are concerned, because the
%% "presto" object is stored there.  Any existing "UserData"
%% is preserved and can even be manipulated as "self.UserData".
%% When the "presto" object is disconnected via its "detach"
%% method, the "UserData" are copied back into the handle.
%%
%%    Graphical events are expected to call "event" with
%% the name of the particular callback.  The "presto/enable"
%% method is useful for automatically enabling all possible
%% callbacks associated with the handle.  In the case of a
%% figure, for example, this would include menus, uicontrols,
%% axes, and all other interactive graphical types.
%%
%%    The users "event" method is responsible for performing
%% all processing associated with a particular event.  The
%% "presto" base-class pays attention only to a "quit" event,
%% due to a "Quit" menu-item, or to clicking in the go-away box.
%% Other events that are passed to the base-class are simply
%% displayed without further action.
%%
%%    Uses can invoke the "inherit" command to pass events
%% to the base-class; its syntax is similar to "feval".
%%
%%    Most activities can be handled by a single "presto"
%% object attached to a figure.  Some situations may warrant
%% other arrangements, however.  For example, the resizing
%% of a window can generate disarray amongst the controls,
%% for which an automated "layout" scheme may be needed.
%% It would make sense to create a "layout" object for
%% each control, whose sole method would be "resize",
%% to be called by the figure whenever it noticed a
%% "ResizeFcn" event.
%%
%%    Presto reacts to the following events,
%% which the derived class should trap as needed:
%%
%% new, open, close, save, saveas,
%% revert, pagesetup, print, quit,
%% undo, cut, copy, paste, clear
%% windowbuttondownfcn, windowbuttonmotionfcn, windowbuttonupfcn,
%% resizefcn, buttondownfcn, callback
%% closerequestfcn, deletefcn
%
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 27-Oct-1999 23:08:50.
%% Updated    05-Nov-1999 20:52:48.
%
%theFigure = figure('Name', 'Presto Demo', 'MenuBar', 'none');
%theStruct.ignore = [];
%self = class(theStruct, 'presto', ps(theFigure));
%psbind(self)
%
%theMenus = { ...
%	'<Presto Demo>', ...
%	'>File', '>>MenuBar', '->Quit', ...
%	'>Help', '>>Controls', '>>Events', ...
%	'>>Handlers', '>>Menus', '>>Subclassing', ...
%	'->Version', ...
%};
%
%menu(self, theMenus)
%
%h = control(self, 'bottom');
%set(h, 'Min', 0, 'Max', 1, 'Value', 0.5);
%h = control(self, 'right');
%set(h, 'Min', 0, 'Max', 1, 'Value', 0.5);
%h = control(self, 'left');
%set(h, 'Min', 0, 'Max', 1, 'Value', 0.5);
%h = control(self, 'top');
%set(h, 'Min', 0, 'Max', 1, 'Value', 0.5);
%
%enable(self);
%
%theEventHandlers = { ...
%	'WindowButtonMotionFcn', 'doscribble', ...
%	'WindowButtonDownFcn', 'doscribble', ...
%	'WindowButtonUpFcn', 'doscribble', ...
%	'ResizeFcn', 'doresize', ...
%	'bottom', 'doroll', ...
%	'right', 'doroll', ...
%	'left', 'doroll', ...
%	'top', 'doroll', ...
%	'menubar', 'domenubar', ...
%	'controls', 'help_controls', ...
%	'events', 'help_events', ...
%	'handlers', 'help_handlers', ...
%	'menus', 'help_menus', ...
%	'subclassing', 'help_subclassing', ...
%	'version', 'help_version', ...
%	'quit', 'doquit', ...
%	'CloseRequestFcn', 'doquit', ...
%};
%
%handler(self, theEventHandlers{:});
%
%n = 36;
%n = n + rem(n, 4);
%[x, y, z] = sphere(n);
%x([1 end], :) = []; y([1 end], :) = []; z([1 end], :) = [];
%c = 1 + 0.1*rand(size(x));
%c = zeros(size(x));
%c(:, 1:n/4) = 1;
%c(:, n/2+1:n/2+n/4) = 1;
%c(:, end) = c(:, 1);
%surface(x, y, z, c)
%xlabel x, ylabel y, zlabel z
%set(gca, 'Color', get(gcf, 'Color'))
%set(gca, 'Visible', 'off')
%view(0, 0)
%axis equal
%disp(' ## Click and move mouse in "presto" window.')
%if nargout > 0
%	theResult = self;
%else
%	assignin('caller', 'ans', self)
%end
%
%% Get the "presto" object from an existing handle.
%
%if nargin > 0
%	if ishandle(theHandle)
%		self = ps(theHandle);
%		if isps
%			if nargout > 0
%				theResult = self;
%			else
%				assignin('caller', 'ans', self)
%				disp(self)
%			end
%			return
%		end
%	elseif isps(theHandle, 'ps')
%		self = theHandle;
%		if nargout > 0
%			theResult = self;
%		else
%			assignin('caller', 'ans', self)
%			disp(self)
%		end
%		return
%	end
%end
%
%if nargout > 0
%	theResult = self;
%else
%	assignin('caller', 'ans', self)
%end
fclose(fout);

disp(' ## Installing: "putfile.m" (text)')
fout = fopen('putfile.m', 'w');
%function theResult = putfile(self, theFileFilter, thePrompt)
%
%% presto/putfile -- Invoke "uiputfile".
%%  putfile(self, 'theSuggested', thePrompt) invokes the
%%   "uiputfile" dialog for the given suggested filename
%%   and prompt.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 01-Nov-1999 11:37:30.
%% Updated    01-Nov-1999 11:37:30.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%if nargin < 2, theSuggested = 'unnamed.mat'; end
%if nargin < 3, thePrompt = 'Select Output File'; end
%
%[theFile, thePath] = uiputfile(theSuggested, thePrompt);
%if ~any(theFile), return, end
%
%if thePath(end) ~= filesep, thePath(end+1) = filesep; end
%result = [thePath theFile];
%
%if nargout > 0
%	theResult = result;
%else
%	assignin('caller', 'ans', result)
%	disp(result)
%end
fclose(fout);

disp(' ## Installing: "version.m" (text)')
fout = fopen('version.m', 'w');
%function version(self)
%
%% Version of 31-May-2002 09:37:55.
%
%helpdlg(help(mfilename), 'presto')
fclose(fout);
cd ('..')
bund_setdir('@ps')

disp(' ## Installing: "control.m" (text)')
fout = fopen('control.m', 'w');
%function theResult = control(self, theStyle, ...
%						theNormalizedPosition, thePixelOffset, ...
%						varargin)
%
%% ps/control -- Create UIControl for "ps".
%%  control(self, 'theStyle', theNormalizedPosition, thePixelOffset)
%%   creates the given control and enables it to be repositioned
%%   in normalized and pixel coordinates during resizing.  The
%%   style may be given as a string, or as an actual control
%%   already present in the figure associated with self, a "px"
%%   object.  Additional name/value pairs can be appended to the
%%   argument list to change the properties of the control.
%%
%%   Note: scrollbars along the edge of the figure can be specified
%%   by their location: 'bottom', 'right', 'top', or 'left'.  The
%%   "String" property will be set to one of those.  For other
%%   controls, the "String" can be set with a name/value pair.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 03-Nov-1999 00:34:10.
%% Updated    04-Nov-1999 16:05:09.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%if nargin < 2, theStyle = 'pushbutton'; end
%if nargin < 3
%	theNormalizedPosition = [0 0 0 0];
%end
%if nargin < 4
%	thePixelOffset = get(0, 'DefaultUIControlPosition');
%end
%
%theTag = '';
%
%switch lower(theStyle)
%case {'xscrollbar', 'hscrollbar', 'bottom'}
%	theString = 'bottom';
%	theTag = 'bottom';
%	theStyle = 'slider';
%	theNormalizedPosition = [0 0 1 0];
%	thePixelOffset = [16 0 -32 16];
%case {'yscrollbar', 'vscrollbar', 'right'}
%	theString = 'right';
%	theTag = 'right';
%	theStyle = 'slider';
%	theNormalizedPosition = [1 0 0 1];
%	thePixelOffset = [-16 16 16 -32];
%case {'zscrollbar', 'left'}
%	theString = 'left';
%	theTag = 'left';
%	theStyle = 'slider';
%	theNormalizedPosition = [0 0 0 1];
%	thePixelOffset = [0 16 16 -32];
%case {'cscrollbar', 'top'}
%	theString = 'top';
%	theTag = 'top';
%	theStyle = 'slider';
%	theNormalizedPosition = [0 1 1 0];
%	thePixelOffset = [16 -16 -32 16];
%end
%
%theLayout = [theNormalizedPosition; thePixelOffset];
%u.itsLayout = theLayout;
%
%if ishandle(theStyle)
%	theControl = theStyle;
%else
%	theControl = uicontrol('Style', theStyle);
%	if ~isempty(varargin)
%		set(theControl, varargin{:})
%	end
%	set(theControl, 'UserData', u, 'Tag', theTag)
%end
%
%doresize(self)
%
%if nargout > 0
%	theResult = theControl;
%end
fclose(fout);

disp(' ## Installing: "data.m" (text)')
fout = fopen('data.m', 'w');
%function theResult = data(self, theNewData)
%
%% ps/data -- Set/get "ps" data.
%%  data(self) gets the data associated
%%   with self, a "ps" object.
%%  data(self, theNewData) sets the data
%%   associated with self to theNewData.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 09-Dec-1999 00:34:18.
%% Updated    09-Dec-1999 05:26:41.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theHandle = handle(self);
%
%u = get(theHandle, 'UserData');
%
%if nargin < 2
%	result = u.ps_Data;
%else
%	u.ps_Data = theNewData;
%	set(theHandle, 'UserData', u)
%	result = self;
%end
%
%if nargin > 0
%	theResult = result;
%else
%	assignin('caller', 'ans', result)
%	disp(result)
%end
fclose(fout);

disp(' ## Installing: "disp.m" (text)')
fout = fopen('disp.m', 'w');
%function theResult = disp(self)
%
%disp(data(self))
fclose(fout);

disp(' ## Installing: "display.m" (text)')
fout = fopen('display.m', 'w');
%function theResult = display(self)
%
%disp(' ')
%disp([inputname(1) ' ='])
%disp(' ')
%disp(self)
fclose(fout);

disp(' ## Installing: "doabout.m" (text)')
fout = fopen('doabout.m', 'w');
%function theResult = doabout(self, varargin)
%
%%    The "ps" class provides a framework for
%% processing interactive graphical events.  It
%% features "dot" syntax for the setting/getting
%% of graphical and user-defined properties.  All
%% events are trapped by calls to "psevent", whose
%% sole argument is the name of Matlab callback
%% (e.g. "ButtonDownFcn").  Use "menu" to add
%% menu items, "control" to add controls, and
%% "enable" to automatically enable the relevant
%% callbacks.  The file "ps_test.m" gives a
%% demonstration.
%%    The "ps" class should be super-classed,
%% and the "event" method should be overloaded.
%
%% ps/doabout -- Post "About PS" message.
%%  doabout(self) posts the "About PS" message,
%%  as seen in the block of text shown above.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 01-Nov-1999 13:53:56.
%% Updated    04-Nov-1999 15:56:44.
%
%helpdlg(help(mfilename), 'About PS')
%
%if nargout > 0, theResult = self; end
fclose(fout);

disp(' ## Installing: "doevent.m" (text)')
fout = fopen('doevent.m', 'w');
%function theResult = doevent(self, theEvent, theMessage, varargin)
%
%% ps/doevent -- Call "ps" event handler.
%%  doevent(self, theEvent, theMessage) calls the registered
%%   event handler on behalf of self, a "ps" object.  Menus
%%   and controls are processed according to their "Tag"
%%   property.  A notice is posted whenever an appropriate
%%   event-handler cannot be found.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 19:28:46.
%% Updated    17-Dec-1999 16:56:40.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%if nargin < 2, theEvent = '(none)'; end
%if nargin < 3, theMessage = []; end
%
%result = [];
%
%h = gcbo;
%if isempty(h) & ishandle(theMessage)
%	h = theMessage;
%end
%
%% Menus and controls are processed via "Tag".
%
%switch get(h, 'Type')
%case {'uimenu', 'uicontrol'}
%	theEvent = get(h, 'Tag');
%end
%
%theHandler = handler(self, theEvent);
%
%okay = logical(0);
%
%if ~isempty(theHandler)
%	try
%		result = builtin('feval', theHandler, self, theEvent, theMessage);
%		okay = logical(1);
%	catch
%		disp([' ## Error while executing handler: ' theHandler])
%	end
%end
%
%if ~okay
%	theEvent = translate(self, theEvent);
%	if isempty(theEvent), theEvent = '(none)'; end
%	theType = get(gcbo, 'Type');
%	disp([' ## No valid event-handler for "' class(self) '" class: "' ...
%				theEvent '" (' theType ' = ' num2str(gcbo) ')'])
%end
%
%if nargout > 0, theResult = self; end
fclose(fout);

disp(' ## Installing: "dohome.m" (text)')
fout = fopen('dohome.m', 'w');
%function theResult = dohome(self, varargin)
%
%% ps/dohome -- Set controls to "home" values.
%%  dohome(self) sets the controls associated with
%%   self, a "ps" object, to their "home" value.
%%   For sliders, this "Value" is midway between
%%   the "Min" and "Max" properties.
%%
%% Note: this routine also needs to force the figure
%%  to update itself.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 10-Dec-1999 01:08:11.
%% Updated    10-Dec-1999 14:27:28.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theSliders = findobj(handle(self), 'Type', 'uicontrol', ...
%							'Style', 'slider');
%					
%for i = 1:length(theSliders)
%	theMin = get(theSliders(i), 'Min');
%	theMax = get(theSliders(i), 'Max');
%	set(theSliders(i), 'Value', mean([theMin theMax]))
%end
%
%axis tight
%set(gca, 'CLimMode', 'auto')
%
%if nargout > 0
%	theResult = self;
%else
%	assignin('caller', 'ans', self)
%end
fclose(fout);

disp(' ## Installing: "domenubar.m" (text)')
fout = fopen('domenubar.m', 'w');
%function theResult = domenubar(self, varargin)
%
%% ps/domenubar -- Toggle the "ps" menubar.
%%  domenubar(self) toggles the menubar on behalf
%%   of self, a "ps" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 04-Nov-1999 15:32:53.
%% Updated    04-Nov-1999 15:32:53.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theMenu = gcbo;
%theFigure = gcbf;
%
%switch lower(get(theFigure, 'MenuBar'))
%case 'figure'
%	set(theFigure, 'MenuBar', 'none')
%	if any(theMenu), set(theMenu, 'Checked', 'off'); end
%case 'none'
%	set(theFigure, 'MenuBar', 'figure')
%	if any(theMenu), set(theMenu, 'Checked', 'on'); end
%end
%
%if nargout > 0, theResult = self; end
fclose(fout);

disp(' ## Installing: "domouse.m" (text)')
fout = fopen('domouse.m', 'w');
%function theResult = domouse(self, theEvent, varargin)
%
%% ps/domouse -- Process "ps" mouse events.
%%  domouse(self, 'theEvent') handles mouse events
%%   on behalf of self, a "ps" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 08:43:30.
%% Updated    14-Dec-1999 16:39:22.
%
%persistent OLD_NAME
%persistent OLD_NUMBER_TITLE
%persistent OLD_POINTER
%persistent SELECTION_TYPE
%
%switch lower(theEvent)
%
%% Mouse play.
%	
%case 'windowbuttonmotionfcn'
%	pt = get(gca, 'CurrentPoint');
%	pt = mean(pt);
%	NEW_NAME = ['[' num2str(pt(1)) ', ' num2str(pt(2)) ', ' num2str(pt(3)) ']'];
%	set(gcbf, 'Name', NEW_NAME)
%case 'windowbuttondownfcn'
%	pt = get(gca, 'CurrentPoint');
%	pt = mean(pt);
%	SELECTION_TYPE = get(gcbf, 'SelectionType');
%	NEW_NAME = ['[' num2str(pt(1)) ', ' num2str(pt(2)) ', ' num2str(pt(3)) ']'];
%	NEW_NUMBER_TITLE = 'off';
%	NEW_POINTER = 'circle';
%	OLD_NAME = get(gcbf, 'Name');
%	OLD_NUMBER_TITLE = get(gcbf, 'NumberTitle');
%	OLD_POINTER = get(gcbf, 'Pointer');
%	set(gcbf, ...
%			'WindowButtonDownFcn', '', ...
%			'WindowButtonMotionFcn', ['psevent WindowButtonMotionFcn'], ...
%			'WindowButtonUpFcn', ['psevent WindowButtonUpFcn'], ...
%			'Name', NEW_NAME, 'NumberTitle', NEW_NUMBER_TITLE, ...
%			'Pointer', NEW_POINTER);
%case 'windowbuttonupfcn'
%	set(gcbf, ...
%			'WindowButtonMotionFcn', '', ...
%			'WindowButtonUpFcn', '', ...
%			'WindowButtonDownFcn', ['psevent WindowButtonDownFcn'], ...
%			'Name', OLD_NAME, 'NumberTitle', OLD_NUMBER_TITLE, ...
%			'Pointer', OLD_POINTER);
%	OLD_NAME = [];
%	OLD_POINTER = [];
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "doquit.m" (text)')
fout = fopen('doquit.m', 'w');
%function theResult = doquit(self, varargin)
%
%% ps/doquit -- Quit a "ps" process.
%%  doquit(self) deletes the handle associated
%%   with self, a "ps" object, then returns
%%   the empty-matrix [].
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:18:31.
%% Updated    09-Dec-1999 03:13:42.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%delete(gcbf)
%
%if nargout > 0
%	theResult = [];
%end
fclose(fout);

disp(' ## Installing: "doresize.m" (text)')
fout = fopen('doresize.m', 'w');
%function theResult = doresize(self, varargin)
%
%% ps/doresize -- Process "resize" event for "ps".
%%  doresize(self) processes a "resize" event on behalf
%%   of self, a "ps" object.  All controls whose "UserData"
%%   appears to be a "layout" are repositioned accordingly.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 02-Nov-1999 23:18:31.
%% Updated    03-Nov-1999 01:29:18.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theFigure = gcbf;
%
%if isempty(theFigure)
%	theFigure = handle(self);
%	while ~isequal(get(theFigure, 'Type'), 'figure')
%		theFigure = get(theFigure, 'Parent');
%	end
%end
%
%oldUnits = get(theFigure, 'Units');
%set(theFigure, 'Units', 'pixels')
%theFigurePos = get(theFigure, 'Position');
%set(theFigure, 'Units', oldUnits)
%
%h = findobj(theFigure, 'Type', 'uicontrol');
%
%for i = 1:length(h)
%	u = get(h(i), 'UserData');
%	if isstruct(u) & isfield(u, 'itsLayout')
%		theLayout = u.itsLayout;
%		if isequal(size(theLayout), [2 4])
%			theNormalizedPos = theLayout(1, :);
%			thePixelOffset = theLayout(2, :);
%			thePos = theFigurePos([3:4 3:4]) .* ...
%						theNormalizedPos + thePixelOffset;
%			oldUnits = get(h(i), 'Units');
%			set(h(i), 'Units', 'pixels')
%			set(h(i), 'Position', thePos)
%			set(h(i), 'Units', oldUnits)
%		end
%	end
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "doscribble.m" (text)')
fout = fopen('doscribble.m', 'w');
%function theResult = doscribble(self, theEvent, varargin)
%
%% ps/doscribble -- Process "ps" mouse events.
%%  doscribble(self, 'theEvent') handles mouse events
%%   on behalf of self, a "ps" object.  The mouse
%%   track is temporarily scribbled in the window.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 08:43:30.
%% Updated    14-Dec-1999 16:46:14.
%
%persistent OLD_NAME
%persistent OLD_NUMBER_TITLE
%persistent OLD_POINTER
%persistent SELECTION_TYPE
%
%switch lower(theEvent)
%
%% Mouse play.
%	
%case 'windowbuttonmotionfcn'
%	pt = get(gca, 'CurrentPoint');
%	pt = mean(pt);
%	NEW_NAME = ['[' num2str(pt(1)) ', ' num2str(pt(2)) ', ' num2str(pt(3)) ']'];
%	set(gcbf, 'Name', NEW_NAME)
%	h = findobj(gcbf, 'Type', 'line', 'Tag', 'ps-scribble');
%	if any(h)
%		h = h(1);
%		x = get(h, 'XData');
%		y = get(h, 'YData');
%		x(end+1) = pt(1);
%		y(end+1) = pt(2);
%		while length(x) > 10
%			x(1) = [];
%			y(1) = [];
%		end
%		set(h, 'XData', x, 'YData', y)
%	end
%case 'windowbuttondownfcn'
%	pt = get(gca, 'CurrentPoint');
%	pt = mean(pt);
%	SELECTION_TYPE = get(gcbf, 'SelectionType');
%	NEW_NAME = ['[' num2str(pt(1)) ', ' num2str(pt(2)) ', ' num2str(pt(3)) ']'];
%	NEW_NUMBER_TITLE = 'off';
%	NEW_POINTER = 'circle';
%	OLD_NAME = get(gcbf, 'Name');
%	OLD_NUMBER_TITLE = get(gcbf, 'NumberTitle');
%	OLD_POINTER = get(gcbf, 'Pointer');
%	set(gcbf, ...
%			'WindowButtonDownFcn', '', ...
%			'WindowButtonMotionFcn', ['psevent WindowButtonMotionFcn'], ...
%			'WindowButtonUpFcn', ['psevent WindowButtonUpFcn'], ...
%			'Name', NEW_NAME, 'NumberTitle', NEW_NUMBER_TITLE, ...
%			'Pointer', NEW_POINTER);
%	h = line(pt(1), pt(2), 'EraseMode', 'xor', ...
%							'Color', [0 0 0], ...
%							'LineWidth', 3.0, ...
%							'LineStyle', '--', ...
%							'Tag', 'ps-scribble');
%case 'windowbuttonupfcn'
%	set(gcbf, ...
%			'WindowButtonMotionFcn', '', ...
%			'WindowButtonUpFcn', '', ...
%			'WindowButtonDownFcn', ['psevent WindowButtonDownFcn'], ...
%			'Name', OLD_NAME, 'NumberTitle', OLD_NUMBER_TITLE, ...
%			'Pointer', OLD_POINTER);
%	OLD_NAME = [];
%	OLD_POINTER = [];
%	h = findobj(gcbf, 'Type', 'line', 'Tag', 'ps-scribble');
%	if ishandle(h), delete(h), end
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "doscroll.m" (text)')
fout = fopen('doscroll.m', 'w');
%function theResult = doscroll(self, theEvent, theMessage)
%
%% ps/doscroll -- Handler for "ps" scrollbars.
%%  doscroll(self, theEvent, theMessage) pans the axes
%%   in keeping with the active scrollbars, on behalf
%%   of self, a "ps" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 21:34:53.
%% Updated    05-Nov-1999 21:34:53.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theXLim = get(gca, 'XLim');   % bottom scrollbar.
%theYLim = get(gca, 'YLim');   % right scrollbar.
%theZLim = get(gca, 'ZLim');   % left scrollbar.
%theCLim = get(gca, 'CLim');   % top scrollbar.
%
%axis tight
%set(gca, 'CLimMode', 'auto')
%
%theEvent = translate(self, theEvent);
%
%switch theEvent
%case 'bottom'
%	theXLim = get(gca, 'XLim');
%	smin = get(gcbo, 'Min');
%	smax = get(gcbo, 'Max');
%	value = get(gco, 'Value');
%	frac = value / (smax - smin);
%	theXLim = theXLim + (frac - 0.5)*diff(theXLim);
%case 'right'
%	theYLim = get(gca, 'YLim');
%	smin = get(gcbo, 'Min');
%	smax = get(gcbo, 'Max');
%	value = get(gco, 'Value');
%	frac = value / (smax - smin);
%	theYLim = theYLim + (frac - 0.5)*diff(theYLim);
%case 'left'
%	theZLim = get(gca, 'ZLim');
%	smin = get(gcbo, 'Min');
%	smax = get(gcbo, 'Max');
%	value = get(gco, 'Value');
%	frac = value / (smax - smin);
%	theZLim = theZLim + (frac - 0.5)*diff(theZLim);
%case 'top'
%	theCLim = get(gca, 'CLim');
%	smin = get(gcbo, 'Min');
%	smax = get(gcbo, 'Max');
%	value = get(gco, 'Value');
%	frac = value / (smax - smin);
%	theCLim = theCLim + (frac - 0.5)*diff(theCLim);
%end
%
%set(gca, 'XLim', theXLim, 'YLim', theYLim, 'ZLim', theZLim, 'CLim', theCLim)
%
%if nargout > 0
%	theResult = self;
%else
%	assignin('caller', 'ans', self)
%end
fclose(fout);

disp(' ## Installing: "doview.m" (text)')
fout = fopen('doview.m', 'w');
%function theResult = doview(self, varargin)
%
%% ps/view -- Toggle between view(2) and view(3).
%%  view(self) toggles the view of axes associated
%%   with self, a "ps" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 10-Nov-1999 08:17:04.
%% Updated    17-Nov-1999 09:05:37.
%
%if nargout > 0, theResult = []; end
%
%theMenu = gcbo;
%
%v = view;
%if norm(diag(view)) > 1.9
%	view(3)
%	if any(theMenu), set(gcbo, 'Checked', 'on'), end
%else
%	view(2)
%	if any(theMenu), set(gcbo, 'Checked', 'off'), end
%end
%
%if nargout > 0
%	theResult = self;
%else
%	assignin('caller', 'ans', self)
%end
fclose(fout);

disp(' ## Installing: "enable.m" (text)')
fout = fopen('enable.m', 'w');
%function theResult = enable(self)
%
%% ps/enable -- Enable "ps" callbacks.
%%  enable(self) enables all the callbacks associated
%%   with self, a "ps" object, except that the "CreateFcn"
%%   and "DeleteFcn" are enabled only for figures.  The
%%   actions are directed to "psevent", using the actual
%%   callback names, as in "psevent ButtonDownFcn".
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 27-Oct-1999 23:30:10.
%% Updated    10-Jan-2002 17:45:15.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theHandle = handle(self);
%h = findobj(theHandle);
%
%for k = 1:length(h)
%	theType = get(h(k), 'Type');
%	theEvents = {};   % Do not include "DeleteFcn" here.
%	switch theType
%	case 'figure'
%		theEvents = [theEvents ...
%			{'WindowButtonDownFcn', 'ResizeFcn', ...
%				'CloseRequestFcn'} ...
%			];
%	case {'axes', 'line', 'patch', 'surface', 'text', 'light'}
%		theEvents = [theEvents {'ButtonDownFcn'}];
%	case 'uicontrol'
%		theEvents = [theEvents {'ButtonDownFcn', 'Callback'}];
%	case 'uimenu'
%		if ~any(get(h(k), 'Children'))
%			theEvents = [theEvents {'Callback'}];
%		end
%	otherwise
%	end
%	for i = 1:length(theEvents)
%		set(h(k), theEvents{i}, ['psevent ' theEvents{i}])
%	end
%end
%
%if nargout > 0, theResult = self; end
fclose(fout);

disp(' ## Installing: "handle.m" (text)')
fout = fopen('handle.m', 'w');
%function theResult = handle(self)
%
%% ps/handle -- Handle of a "ps" object.
%%  handle(self) returns the handle associated
%%   with self, a "ps" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 09-Dec-1999 00:30:47.
%% Updated    09-Dec-1999 00:30:47.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%result = ps(self);
%
%if nargout > 0
%	theResult = result;
%else
%	assignin('caller', 'ans', result')
%	disp(result)
%end
fclose(fout);

disp(' ## Installing: "handler.m" (text)')
fout = fopen('handler.m', 'w');
%function [theResult, theEvent] = handler(self, varargin)
%
%% ps/handler -- Register a "ps" event-handler.
%%  handler(self, 'theEvent', 'theHandler') registers 'theEvent'
%%   and 'theHandler' on behalf of self, a "ps" object.
%%   Additional event/handler pairs can be given in the
%%   argument-list.
%%  handler(self, 'theEvent') returns the handler for theEvent,
%%   or [] is no such handler has been registered.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 00:21:39.
%% Updated    05-Nov-1999 00:21:39.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theHandlers = psget(self, 'itsHandlers');
%
%% Get all the handlers.
%
%if nargin < 2
%	if nargout > 0
%		theResult = theHandlers;
%	else
%		assignin('caller', 'ans', theHandlers)
%		disp(theHandlers)
%	end
%	return
%end
%
%% Clean-up the event string.
%
%for k = 1:2:length(varargin)
%	varargin{k} = translate(self, varargin{k});
%end
%
%% Return the handler for the event.
%
%if nargin < 3
%	theEvent = varargin{1};
%	theHandler = [];
%	if ~isempty(theHandlers)
%		if isfield(theHandlers, theEvent)
%			theHandler = getfield(theHandlers, theEvent);
%		end
%	end
%	if nargout > 0
%		theResult = theHandler;
%	else
%		assignin('caller', 'ans', theHandler)
%		disp(theHandler)
%	end
%	return
%end
%
%% Register the events and handlers.
%
%for k = 1:2:length(varargin)
%	theEvent = varargin{k};
%	theHandler = varargin{k+1};
%	theHandlers = setfield(theHandlers, theEvent, theHandler);
%end
%
%self = psset(self, 'itsHandlers',  theHandlers);
%
%if nargout > 0
%	theResult = self;
%else
%	assignin('caller', 'ans', self)
%end
fclose(fout);

disp(' ## Installing: "help_controls.m" (text)')
fout = fopen('help_controls.m', 'w');
%function theResult = help_controls(self, varargin)
%
%%    The "ps/control" method adds controls to the
%% "ps" window.  Standard scrollbars are indicated
%% by the names: 'bottom', 'right', 'top,' or 'left'.
%% Other controls are denoted by their "Style" property,
%% as in 'pushbutton'.
%%    Each control requires a "layout", consisting of a
%% normalized-position and a pixel-offset.  The "layout"
%% information is used by "ps/doresize" to adjust
%% each control whenever the window is resized.
%%    The "ps/control" method returns the handle of
%% the new control, so that further embellishments can
%% be made.
%%    See "help ps/control".
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 04-Nov-1999 14:41:34.
%% Updated    04-Nov-1999 14:54:02.
%
%h = help(mfilename);
%helpdlg(h, 'PS Controls')
%
%if nargout > 0, theResult = self; end
fclose(fout);

disp(' ## Installing: "help_events.m" (text)')
fout = fopen('help_events.m', 'w');
%function theResult = help_events(self, varargin)
%
%%    Whenever a mouse event occurs on a "ps" object,
%% a callback reading "psevent theEventName" is executed,
%% where theEventName will be something like "ButtonDownFcn".
%% The "ps/doevent" method is responsible for translating
%% the event into an action.  Events from controls and menus
%% are converted to the name of the callback-object.  All
%% events are then converted to lower-case, deblanked, and
%% trimmed, leaving only alphanumeric characters.  The
%% result is given to a 'switch" ladder for final dispatching.
%%    When a new class is derived from "ps", it must
%% supply a "doevent" method of its own to override the
%% default "ps" behavior, as appropriate.  To invoke
%% the default behavior in a particular situation, call
%% "inherit(self, 'theEventName')".
%%    See "help psevent" and "ps/doevent".
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 04-Nov-1999 14:41:34.
%% Updated    04-Nov-1999 14:54:02.
%
%h = help(mfilename);
%helpdlg(h, 'PS Events')
%
%if nargout > 0, theResult = self; end
fclose(fout);

disp(' ## Installing: "help_handlers.m" (text)')
fout = fopen('help_handlers.m', 'w');
%function theResult = help_handlers(self, varargin)
%
%%    Event-handlers are registered with "ps" using the
%% "handler" method, which requires the name of an event,
%% such as 'Print', and the name of the corresponding method
%% that will handle the event, such as 'doprint'.  Any number
%% of event/handler pairs can be placed in the argument list,
%% as in "self = handler(self, theEvent, theHandler, ...)".
%%    Handlers are always called with three input arguments,
%% as in "self = doprint(self, theEvent, theMessage)".
%%    See "help ps/handler".
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 04-Nov-1999 14:41:34.
%% Updated    05-Nov-1999 20:08:50.
%
%h = help(mfilename);
%helpdlg(h, 'PS Handlers')
%
%if nargout > 0, theResult = self; end
fclose(fout);

disp(' ## Installing: "help_menus.m" (text)')
fout = fopen('help_menus.m', 'w');
%function theResult = help_menus(self, varargin)
%
%%    The "ps/menu" method adds menus to the PS
%% menubar, using a cell-array of the desired menu labels,
%% arranged in top-down fashion.  Prepended to each label
%% is one ">" for each stage below the top-level menu.
%% For a separator-line between menus, use "-" in place
%% of one of the ">" symbols.
%%    Menus call "event Callback" when selected.  Inside
%% "ps/doevent", the event is translated into the menu
%% label of the instigator, then processed in the "switch"
%% ladder, as described in the "Help/Events" menu.
%%    See "help ps/menu".
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 04-Nov-1999 14:41:34.
%% Updated    04-Nov-1999 14:54:02.
%
%h = help(mfilename);
%helpdlg(h, 'PS Menus')
%
%if nargout < 1, theResult = self; end
fclose(fout);

disp(' ## Installing: "help_subclassing.m" (text)')
fout = fopen('help_subclassing.m', 'w');
%function theResult = help_subclassing(self, varargin)
%
%%    Users of PS are expected to derive their own class
%% from "ps".   One such class, "pst" has already been
%% built as an example.  It can be copied and renamed to serve
%% as a framework for the derived class.  Unless "pst/doevent"
%% is modified, all events will passed intact to "ps".
%%    See "help pst".
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 20:46:35.
%% Updated    05-Nov-1999 20:46:35.
%
%h = help(mfilename);
%helpdlg(h, 'PS Subclassing')
%
%if nargout > 0, theResult = self; end
fclose(fout);

disp(' ## Installing: "help_version.m" (text)')
fout = fopen('help_version.m', 'w');
%function theResult = help_version(self, varargin)
%
%% presto/help_version-- Show "presto" version.
%%  help_version(self) shows the version of 'presto"
%%   currently active.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 04-Nov-1999 15:17:29.
%% Updated    04-Nov-1999 15:17:29.
%
%h = help('ps/version');
%helpdlg(h, 'PS Version')
%
%if nargout > 0, theResult = self; end
fclose(fout);

disp(' ## Installing: "menu.m" (text)')
fout = fopen('menu.m', 'w');
%function [theResult, theMenuHandles] = menu(self, theLabels)
%
%% ps/menu -- Add a menu to a "ps" window.
%%  menu(self, {theLabels}) adds menus using {theLabels},
%%   a cell-array of strings, to the "ps" figure.
%%   If an entry is itself a cell, the first element
%%   is the label, the second (if any) is the accelerator
%%   key, and the third (if any) is the "on/off" "Checked"
%%   property.  (Note: Matlab's own menu accelerators
%%   take precedence.)  Self is returned.
%%  [self, theMenuHandles] also returns the menu handles.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 28-Oct-1999 14:35:15.
%% Updated    26-Nov-1999 15:02:35.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%if ~iscell(theLabels), theLabels = {theLabels}; end
%
%theHandle = handle(self);
%while ~isequal(get(theHandle, 'Type'), 'figure')
%	theHandle = get(theHandle, 'Parent');
%end
%
%theHandles = [theHandle];
%theMenuHandles = [];
%
%for i = 1:length(theLabels)
%	theLabel = theLabels{i};
%	theAccelerator = get(0, 'DefaultUIMenuAccelerator');
%	theChecked = get(0, 'DefaultUIMenuChecked');
%	if iscell(theLabel)
%		if length(theLabel) > 2, theChecked = theLabel{3}; end
%		if length(theLabel) > 1, theAccelerator = theLabel{2}; end
%		if length(theLabel) > 0, theLabel = theLabel{1}; end
%	end
%	theSeparator = 'off';
%	theLevel = 0;
%	while any(theLabel(1) == '>-')
%		if theLabel(1) == '-'
%			theSeparator = 'on';
%		end
%		theLevel = theLevel+1;
%		theLabel(1) = [];
%	end
%	theTag = theLabel;
%	theMenu = uimenu(theHandles(theLevel+1), ...
%						'Label', theLabel, ...
%						'Tag', theTag, ...
%						'Accelerator',theAccelerator, ...
%						'Checked',theChecked, ...
%						'Separator', theSeparator);
%	theHandles(theLevel+2) = theMenu;
%	theMenuHandles(end+1) = theMenu;
%end
%
%if nargout > 0
%	theResult = self;
%	theMenuHandles = theMenuHandles(:);   % Column-vector.
%else
%	assignin('caller', 'ans', self)
%end
fclose(fout);

disp(' ## Installing: "ps.m" (text)')
fout = fopen('ps.m', 'w');
%function theResult = ps(theHandle)
%
%% ps/ps -- Constructor for "ps" class.
%%  ps(theHandle) attaches theHandle to a new "ps"
%%   object, unless the handle is already associated
%%   with such an object.  In either case, the object
%%   itself is returned.  The default graphics entity
%%   is a new figure named "PS".
%%  ps(aPSObject) returns the handle associated
%%   with the given "ps" object.
%% Also see: "help ps_test".
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 09-Dec-1999 00:12:19.
%% Updated    09-Dec-1999 05:26:41.
%
%if nargout < 1 & nargin < 1
%	setdef(mfilename)
%	return
%end
%
%if nargout > 0, theResult = []; end
%
%if nargin < 1
%	help(mfilename)
%	theHandle = figure('Name', 'PS');
%end
%
%% Convert existing handle to "ps" object.
%
%switch class(theHandle)
%case 'double'
%	if ishandle(theHandle)
%		u = get(theHandle, 'UserData');
%		if isstruct(u) & isfield(u, 'ps_Self')
%			theSelf = u.ps_Self;
%			if isa(theSelf, 'ps')
%				self = theSelf;
%				if nargout > 0
%					theResult = self;
%				else
%					assignin('caller', 'ans', self)
%				end
%				return
%			end
%		end
%	end
%end
%
%% Convert existing "ps" object to its handle.
%
%if isa(theHandle, 'ps')
%	self = theHandle;
%	theHandle = self.itsHandle;
%	if nargout > 0
%		theResult = theHandle;
%	else
%		assignin('caller', 'ans', theHandle)
%	end
%	return
%end
%
%% Create a new "ps" object.
%		
%theStruct.itsHandle = [];
%self = class(theStruct, 'ps');
%self.itsHandle = theHandle;
%
%% Note names of the key elements: "ps_Self" and "ps_Data".
%%  These appear also in "isps()" and "ps/data()".  Make
%%  sure they are used consistently throughout.
%
%psbind(self)
%
%if nargout > 0
%	theResult = self;
%else
%	assignin('caller', 'ans', self)
%end
fclose(fout);

disp(' ## Installing: "psget.m" (text)')
fout = fopen('psget.m', 'w');
%function theResult = psget(self, theField)
%
%% ps/psget -- Get a "ps" field value.
%%  psget(self, 'theField') returns the value of
%%   'theField' associated with self, a "ps" object.
%%   The empty matrix [] is returned if no such
%%   field exists.  If the field is the name of
%%   a property of the handle associated with
%%   self, that property is returned.
%%  psget(self) returns all the current "ps" fields
%%   in a "struct".
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 09-Dec-1999 00:44:58.
%% Updated    09-Dec-1999 00:44:58.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%result = [];
%
%if nargin < 2
%	result = psset(self);
%else
%	result = psset(self, theField);
%end
%
%if nargout > 0
%	theResult = result;
%else
%	assignin('caller', 'ans', result)
%end
fclose(fout);

disp(' ## Installing: "psset.m" (text)')
fout = fopen('psset.m', 'w');
%function theResult = psset(self, theField, theValue)
%
%% ps/psset -- Set a "ps" field value.
%%  psset(self, 'theField', theValue) sets the value
%%   of 'theField' associated with self, a "ps" object,
%%   to theValue.  If the field is the name of a graphics
%%   associated with the handle of self, that property is
%%   set.
%%  psset(self, 'theField') returns the value of the field.
%%  psset(self) returns all the current "ps" fields in a 
%%   "struct".
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 09-Dec-1999 00:44:58.
%% Updated    09-Dec-1999 00:44:58.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%result = [];
%
%if nargin < 2
%	result = data(self);
%elseif nargin < 3
%	try
%		if ~isequal(lower(theField), 'userdata')
%			result = get(handle(self), theField);
%		else
%			theData = data(self);
%			result = theData.UserData;
%		end
%	catch
%		theData = data(self);
%		if isfield(theData, theField)
%			result = getfield(theData, theField);
%		end
%	end
%else
%	try
%		if ~isequal(lower(theField), 'userdata')
%			set(handle(self), theField, theValue);
%			result = self;
%		else
%			theData = setfield(data(self), 'UserData', theValue);
%			result = data(self, theData);
%		end
%	catch
%		theData = setfield(data(self), theField, theValue);
%		result = data(self, theData);
%	end
%end
%
%if nargout > 0
%	theResult = result;
%else
%	assignin('caller', 'ans', result)
%end
fclose(fout);

disp(' ## Installing: "px.m" (text)')
fout = fopen('px.m', 'w');
%function [varargout] = px(varargin)
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 17-Dec-1999 16:12:35.
%% Updated    17-Dec-1999 16:12:35.
%
%disp([' ## Obsolete function: ' mfilename])
%
%varargout = cell(1, nargout);
%
%if nargout > 0
%	[varargout{:}] = ps(varargin{:});
%else
%	ps(varargin{:});
%end
fclose(fout);

disp(' ## Installing: "pxget.m" (text)')
fout = fopen('pxget.m', 'w');
%function [varargout] = pxget(varargin)
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 17-Dec-1999 16:12:35.
%% Updated    20-Dec-1999 13:03:33.
%
%warning(' ## Obsolete function...')
%disp([' ## Obsolete function: ' mfilename])
%
%varargout = cell(1, nargout);
%
%if nargout > 0
%	[varargout{:}] = psget(varargin{:});
%else
%	psget(varargin{:});
%end
fclose(fout);

disp(' ## Installing: "pxset.m" (text)')
fout = fopen('pxset.m', 'w');
%function [varargout] = pxset(varargin)
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 17-Dec-1999 16:12:35.
%% Updated    20-Dec-1999 13:03:33.
%
%warning(' ## Obsolete function...')
%disp([' ## Obsolete function: ' mfilename])
%
%varargout = cell(1, nargout);
%
%if nargout > 0
%	[varargout{:}] = psset(varargin{:});
%else
%	psget(varargin{:});
%end
fclose(fout);

disp(' ## Installing: "README.m" (text)')
fout = fopen('README.m', 'w');
%README -- Documentation for the "ps" class.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 09-Dec-1999 01:55:25.
%% Updated    09-Dec-1999 01:55:25.
%
%The "ps" class in the "Presto" toolbox replaces the "px"
%class of the "Proxy" toolbox.  The new class is much
%simpler in design, easier to maintain, and extensible.
%
%Two features make "ps" objects attractive:
%
%	(1)	Their data can be extended arbitrarily, using simple
%		Matlab "." syntax for assigning and referencing the
%		fields.  Whenever such a field-name is thename of
%		an associated graphics property, the property itself
%		is targetted.  Unlike Matlab's "set/get" scheme, "ps"
%		subscripting can be nested to any depth that makes
%		sense, so that specific portions of a property or
%		field can be accessed directly.  Thus, "myPS.color(2)"
%		could refer to the second element of color in (say)
%		a figure attached to myPS, a "ps" object.
%		
%	(2)	Classes can be derived from "ps" without restricting
%		access to any of the user's data.  This behavior is
%		unlike that seen in regular Matlab objects, whose
%		data is cosidered "private".
%		
%The "ps" class is designed for handling events generated
%by graphical user interfaces, such as dialogs.  Menus
%and controls are easily created and connected to particular
%handlers (methods).  Events are typically funneled into
%a method called "doevent", whose argument is usually the
%name of the callback, as in "psevent ResizeFcn".
%
%The "ps_test.m" demonstration program shows hows to install
%menus and controls in a figure.
%
%Needed:
%
%1.	A "bind()" routine, to be applied after the "ps" object
%	is created, so that the correct object is stored in the
%	"UserData" of the associated handle.
%	
%2.	Inheritance in "PST".
fclose(fout);

disp(' ## Installing: "subsasgn.m" (text)')
fout = fopen('subsasgn.m', 'w');
%function theResult = subsasgn(self, theStruct, theValue)
%
%% ps/subsasgn -- Process subscripted references.
%%  subsasgn(self, theStruct, theValue) processes
%%   assignments on behalf of self, a "ps" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 09-Dec-1999 01:19:01.
%% Updated    09-Dec-1999 01:19:01.
%
%if nargin < 2, help(mfilename), return, end
%
%theType = theStruct(1).type;
%theSubs = theStruct(1).subs;
%if ~iscell(theSubs), theSubs = {theSubs}; end
%theStruct(1) = [];
%
%switch theType
%case '.'
%	if length(theStruct) < 1
%		result = psset(self, theSubs{1}, theValue);
%	else
%		temp = psget(self, theSubs{1});
%		temp = subsasgn(temp, theStruct, theValue);
%		result = psset(self, theSubs{1}, temp);
%	end
%otherwise
%end
%
%theResult = result;
fclose(fout);

disp(' ## Installing: "subsindex.m" (text)')
fout = fopen('subsindex.m', 'w');
%function theResult = subsindex(self)
%
%% ps/subsindex -- Value of a "ps" as an index.
%%  subsindex(self) posts an error, since "ps"
%%   objects may not be used as indices.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 09-Dec-1999 02:51:19.
%% Updated    09-Dec-1999 02:51:19.
%
%error(' ## "ps" objects may not be used as indices.')
fclose(fout);

disp(' ## Installing: "subsref.m" (text)')
fout = fopen('subsref.m', 'w');
%function theResult = subsref(self, theStruct)
%
%% ps/subsref -- Process subscripted references.
%%  subsref(self, theStruct) processes subscripted
%%   references on behalf of self, a "ps" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 09-Dec-1999 01:19:01.
%% Updated    09-Dec-1999 01:19:01.
%
%if nargin < 2, help(mfilename), return, end
%
%theType = theStruct(1).type;
%theSubs = theStruct(1).subs;
%if ~iscell(theSubs), theSubs = {theSubs}; end
%theStruct(1) = [];
%
%switch theType
%case '.'
%	result = psget(self, theSubs{1});
%	if length(theStruct) > 0
%		result = subsref(result, theStruct);
%	end
%otherwise
%end
%
%theResult = result;
fclose(fout);

disp(' ## Installing: "translate.m" (text)')
fout = fopen('translate.m', 'w');
%function theResult = translate(self, theEvent)
%
%% ps/translate -- Translate a "ps" event.
%%  translate(self, 'theEvent') converts 'theEvent'
%%   to canonical form for use by "ps" event
%%   handlers.  The result is lowercase, free of
%%   blanks, and consists entirely of alphanumeric
%%   characters and '_'.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 09-Dec-1999 02:45:49.
%% Updated    09-Dec-1999 02:45:49.
%
%if nargout > 0, theResult = []; end
%if nargin < 2, help(mfilename), return, end
%
%result = lower(theEvent);
%
%theLetters = char([abs('a'):abs('z') abs('0'):abs('9') '_']);
%for i = length(result):-1:1
%	if ~any(result(i) == theLetters)
%		result(i) = '';
%	end
%end
%
%if nargout > 0
%	theResult = result;
%else
%	assignin('caller', 'ans', result)
%	disp(result)
%end
fclose(fout);

disp(' ## Installing: "version.m" (text)')
fout = fopen('version.m', 'w');
%function version(self)
%
%% Version of 31-May-2002 09:37:55.
%
%helpdlg(help(mfilename), 'ps')
fclose(fout);
cd ('..')
bund_setdir('@pst')

disp(' ## Installing: "docontrol.m" (text)')
fout = fopen('docontrol.m', 'w');
%function theResult = docontrol(self, theEvent, varargin)
%
%% pst/docontrol -- Handler for "pst" controls.
%%  docontrol(self, 'theEvent') handles 'theEvent' on
%%   behalf of self, a "pst" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 11:49:51.
%% Updated    05-Nov-1999 15:00:06.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%result = inherit('docontrol', self, theEvent);
%
%if nargout > 0
%	theResult = result;
%end
fclose(fout);

disp(' ## Installing: "doevent.m" (text)')
fout = fopen('doevent.m', 'w');
%function theResult = doevent(self, theEvent, theMessage, varargin)
%
%% pst/doevent -- Call "pst" event handler.
%%  doevent(self, theEvent, theMessage) calls the appropriate
%%   event handler on behalf of self, a "pst" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 19:28:46.
%% Updated    05-Nov-1999 19:34:37.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%if nargin < 2, theEvent = '(none)'; end
%if nargin < 3, theMessage = []; end
%
%result = [];
%
%switch get(gcbo, 'Type')
%case 'uimenu*'
%	result = domenu(self, theEvent, theMessage);
%case 'uicontrol*'
%	result = docontrol(self, theEvent, theMessage);
%otherwise
%	theHandler = handler(self, theEvent);
%	if ~isempty(theHandler)
%		result = builtin('feval', theHandler, self, theEvent, theMessage);
%	else
%		if isempty(theEvent), theEvent = '(none)'; end
%		theType = get(gcbo, 'Type');
%		disp([' ## ' datestr(now, 13) ' ' theEvent ' ' theType ' ' num2str(gcbo)])
%	end
%end
%
%if isa(result, 'pst')
%	self = result;
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "domenu.m" (text)')
fout = fopen('domenu.m', 'w');
%function theResult = domenu(self, theEvent, varargin)
%
%% pst/domenu -- Handler for "pst" menus.
%%  domenu(self, 'theEvent') handles 'theEvent' on
%%   behalf of self, a "pst" object.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 11:49:51.
%% Updated    05-Nov-1999 15:00:06.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%try
%	theHandler = handler(self, theEvent);
%	result = builtin('feval', theHandler, self, theEvent);
%catch
%	errormsg(self)
%end
%
%if nargout > 0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "event.m" (text)')
fout = fopen('event.m', 'w');
%function theResult = event(self, theEvent, theMessage)
%
%% pst/event -- Event dispatcher for "presto".
%%  event(self, theEvent, theMessage) dispatches theEvent
%%   to the appropriate handler on behalf of self, a "pst"
%%   object.  In its present form, this routine only calls
%%   event-handlers inherited from "presto", its superclass.
%%   Users must modify this method to customize its behavior.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 20:11:19.
%% Updated    05-Nov-1999 21:04:58.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%if nargin < 2, theEvent = ''; end
%if nargin < 3, theMessage = ''; end
%
%result = [];
%
%% Get a genuine copy of self.
%
%self = retrieve(self);
%
%% Dispatch the event.
%
%theEvent = translate(self, theEvent);
%
%switch theEvent
%case {'some custom event'}   % Customized processing here.
%	result = doevent(self, theEvent, theMessage);
%otherwise   % Inherit.
%	result = inherit('event', self, theEvent);
%end
%
%% Restore self.
%
%if isa(result, 'pst')
%	self = result;
%	self = restore(self);
%end
%
%% Output.
%
%if nargout > 0, theResult = self; end
fclose(fout);

disp(' ## Installing: "pst.m" (text)')
fout = fopen('pst.m', 'w');
%function theResult = pst(varargin)
%
%% pst/pst -- Constructor for "pst" class.
%%  pst(...) constructs a "pst" object from the given
%%   arguments.  Use this class as a template for
%%   deriving a customized class from "ps".
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 05-Nov-1999 20:11:19.
%% Updated    05-Nov-1999 20:11:19.
%
%theStruct.ignore = [];
%
%myPS = ps(figure);
%theFigure = handle(myPS);
%
%self = class(theStruct, 'pst', myPS);
%
%u = get(theFigure, 'UserData');   % We need a "bind" routine.
%u.ps_Self = self;
%set(theFigure, 'UserData', u)
%
%if nargout  0
%	theResult = self;
%end
fclose(fout);

disp(' ## Installing: "version.m" (text)')
fout = fopen('version.m', 'w');
%function version(self)
%
%% Version of 31-May-2002 09:37:55.
%
%helpdlg(help(mfilename), 'pst')
fclose(fout);
cd ('..')

disp(' ## Installing: "README.m" (text)')
fout = fopen('README.m', 'w');
%README -- Presto Tool Box
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 03-Nov-1999 08:17:54.
%% Updated    14-Dec-1999 14:34:50.
%
%The "PS" Class
%
%Presto's "ps" class provides a framework for handling
%events generated by interactive graphical components
%in Matlab-5.  Users are expected to derive their own
%class from the "ps" class and then provide a
%"doevent" method to overload the basic "ps" behavior,
%as needed.  Methods for creating menus, controls, and
%user-defined properties are included.
%
%How Presto Works
%
%The "ps" constructor writes a "ps" object into
%the "UserData" of the graphical entity to which it
%will be attached, typically a "figure".  Key callbacks
%of the associated graphical components are forced to
%invoke "psevent the_callback_name" whenever they are
%manipulated with the mouse.  The "ps" object itself
%is extracted from the GUI, and its "doevent" method is
%called as "doevent(self, the_callback_name)".  In the
%case of menus and controls, the callback-name is
%translated to the tag of the particular item
%before the "doevent" method is invoked.
%
%The basic "doevent" method is a "switch" ladder, which
%uses the names of the callbacks to decide how to act
%upon any request.
%
%User-Defined Properties
%
%Users may set and get additional properties of their own
%choosing for each "ps" object, using the standard
%"dot" syntax associated with Matlab "struct" entities.
%Interestingly, if the requested property happens to be
%an actual graphical property, it is instituted directly.
%Thus, whether dealing with a GUI property, or a user-defined
%property, the same "dot" syntax works for both.  Indeed, the
%"ps" subscripting abilities are versatile, unlike the
%Matlab "set/get" commands.
%
%Example:
%
%p = ps(anyFigure)
%p.myColor = [0 1 1]
%p.color = p.myColor
%
%Menus
%
%In "ps", uimenus are created with the "menu" method, whose
%second argument is the name of the menu-item, suitably prefixed
%with an indication of where it lies in the menu heirarchy.
%When enables, these menus call the "event" method, which cleans
%up the name before deciding what to do.  For example, "Open..."
%is translated into "open" before the switch-ladder is executed.
%
%Controls
%
%The "control" method allocates uicontrols, whose layout is defined
%in normalized units, plus pixel offsets.  Whenever a "ResizeFcn"
%event occurs in "presto", all such controls are themselves
%resized to fit the new figure geometry.  This scheme is very
%important for preserving the appearance of the figure, an
%ability not otherwise available in Matlab.
%
%Standard scrollbars are created using the keywords "right", "bottom",
%"left", and "top" as the style-name in the "control" method.  This
%facilitates immensely the otherwise difficult burden of positioning
%Matlab scrollbars (sliders).
fclose(fout);

disp(' ## Installing: "inherit.m" (text)')
fout = fopen('inherit.m', 'w');
%function varargout = inherit(method, self, varargin)
%
%% inherit -- Inherit a superclass method.
%%  varargout = inherit('method', self, varargin) calls
%%   the superclass 'method' of self, an object, with the
%%   given input and output arguments.  The routine
%%   climbs the inheritance tree if needed.
%
%% Copyright (C) 1996 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without written consent from the
%%    copyright owner does not constitute publication.
%
%if nargin < 2, help inherit, return, end
%
%if ~isobject(self), return, end
%
%theSuperObject = super(self);
%varargin = [cell(1, 0); varargin];
%
%while isobject(theSuperObject)
%   varargin{1} = theSuperObject;
%   failure = 0;
%   eval(vargstr(method, varargin, varargout), 'failure = 1;')
%   if ~failure, break; end
%   theSuperObject = super(theSuperObject);
%end
fclose(fout);

disp(' ## Installing: "isps.m" (text)')
fout = fopen('isps.m', 'w');
%function theResult = isps(theItem)
%
%% isps -- Is this a "ps" object?
%%  isps(theItem) returns logical(1) (TRUE) if theItem
%%   is a "ps" object or is derived from the "ps"
%%   class; otherwise, it returns logical(0) (FALSE).
%%   If theItem is a handle, the corresponding "UserData"
%%   is examined instead.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 07-Dec-1999 23:19:23.
%% Updated    09-Dec-1999 05:26:41.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%result = logical(0);
%
%switch class(theItem)
%case 'double'
%	if ishandle(theItem)
%		u = get(theItem, 'UserData');
%		if isstruct(u) & isfield(u, 'ps_Self')
%			result = isa(getfield(u, 'ps_Self'), 'ps');
%		end
%	end
%otherwise
%	result = isa(theItem, 'ps');
%end
%
%if nargout > 0
%	theResult = result;
%else
%	assignin('caller', 'ans', result)
%	disp(result)
%end
fclose(fout);

disp(' ## Installing: "presto_bundle.m" (text)')
fout = fopen('presto_bundle.m', 'w');
%function presto_bundle
%
%% presto_bundle -- Bundle "presto" software.
%%  presto_bundle (no argument) bundles the
%%   "presto" software into "presto_install.p".
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 03-Nov-1999 08:11:48.
%% Updated    31-May-2002 09:37:07.
%
%theMFiles = {
%	'README'
%	'setdef'
%	'presto_bundle'
%	'inherit'
%	'super'
%	'isps'
%	'psbind'
%	'psevent'
%	'ps_test'
%};
%
%theMFiles = sort(theMFiles);
%
%theClasses = {
%	'presto'
%	'ps'
%	'pst'
%};
%
%theMessage = {
%	' '
%	' ## To get started, put the "presto" folder in your Matlab'
%	' ##  path, then execute "ps_test" at the Matlab prompt.'
%};
%
%for i = 1:length(theClasses)
%	newversion(theClasses{i})
%end
%
%at(mfilename)
%
%bund new presto
%bund setdir presto
%bund('class', theClasses)
%bund('mfile', theMFiles)
%bund('cd', '..')
%bund('disp', theMessage)
%bund close
fclose(fout);

disp(' ## Installing: "ps_test.m" (text)')
fout = fopen('ps_test.m', 'w');
%function theResult = ps_test
%
%% ps_test -- Test procedure for "ps" class.
%%  ps_test (no argument) creates a window
%%   and returns the controlling "ps" object.
%%   Note: Not all of the mouse actions have
%%   corresponding handlers in this procedure.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 28-Oct-1999 09:27:50.
%% Updated    14-Dec-1999 16:50:42.
%
%setdef(mfilename)
%
%p = ps(figure('Name', mfilename, 'Units', 'normalized'));
%figure(handle(p))
%
%% Handlers.
%
%theEventHandlers = { ...
%	'windowbuttonmotionfcn', 'doscribble', ...
%	'windowbuttondownfcn', 'doscribble', ...
%	'windowbuttonupfcn', 'doscribble', ...
%	'resizefcn', 'doresize', ...
%	'closerequestfcn', 'doquit',...
%	...
%	'ps', 'dops', ...
%	'about', 'doabout', ...
%	'file', 'dofile', ...
%	'new', 'donew', ...
%	'open', 'doopen', ...
%	'close', 'doclose', ...
%	'save', 'dosave', ...
%	'saveas', 'dosaveas', ...
%	'revert', 'dorevert', ...
%	'pagesetup', 'dopagesetup', ...
%	'print', 'doprint', ...
%	'quit', 'doquit', ...
%	...
%	'edit', 'doedit', ...
%	'undo', 'doundo', ...
%	'cut', 'docut', ...
%	'copy', 'docopy', ...
%	'paste', 'dopaste', ...
%	'clear', 'doclear', ...
%	'home', 'dohome', ...
%	'menubar', 'domenubar', ...
%	'view', 'doview', ...
%	...
%	'controls', 'help_controls', ...
%	'events', 'help_events', ...
%	'handlers', 'help_handlers', ...
%	'menus', 'help_menus', ...
%	'subclassing', 'help_subclassing', ...
%	'version', 'help_version', ...
%	...
%	'bottom', 'doscroll', ...
%	'right', 'doscroll', ...
%	'left', 'doscroll', ...
%	'top', 'doscroll', ...
%};
%
%p = handler(p, theEventHandlers{:});
%
%% Menus.
%
%thePSMenu = {
%	'<PS>'
%};
%
%theAboutMenu = {
%	'About...'
%};
%
%theFileMenu = {
%	'File'
%	'>New...'
%	'>Open...'
%	'-Close'
%	'>Save'
%	'>Save As...'
%	'>Revert'
%	'-Page Setup...'
%	'>Print...'
%	'-Quit'
%};
%
%theEditMenu = {
%	'Edit'
%	'>Undo'
%	'-Cut'
%	'>Copy'
%	'>Paste'
%	'>Clear'
%	{'-Home', 'H', 'off'}
%	{'>Menubar', 'M', 'on'}
%	{'>View', '=', 'off'}
%};
%
%theHelpMenu = {
%	'Help'
%	'>Controls...'
%	'>Events...'
%	'>Handlers...'
%	'>Menus...'
%	'>Subclassing...'
%	'>Version...'
%};
%
%theMenus = [thePSMenu; theAboutMenu; ...
%				theFileMenu; theEditMenu; theHelpMenu];
%for i = 2:length(theMenus)
%	if iscell(theMenus{i})
%		theMenus{i}{1} = ['>' theMenus{i}{1}];
%	else
%		theMenus{i} = ['>' theMenus{i}];
%	end
%end
%
%menu(p, theMenus)
%
%patch
%surface
%text(1, .5, 'Hello World! This is PS.')
%x = (0.1:0.02:0.9);
%y = rand(size(x)) + 1.5;
%line(x, y)
%
%h(1) = control(p, 'right');
%h(2) = control(p, 'bottom');
%h(3) = control(p, 'left');
%h(4) = control(p, 'top');
%set(h, 'Min', 0, 'Max', 1, 'Value', 0.5)
%
%h = control(p, 'radiobutton', [0.5 0.5 0 0], [-30 -20 60 20]);
%set(h, 'String', 'Okay')
%
%p = enable(p);
%
%p = ps(gcf);
%
%p.Color = [0 100 100]/100;
%p.MenuBar = 'none';
%
%if nargout > 0
%	theResult = p;
%else
%	assignin('caller', 'ans', p)
%end
fclose(fout);

disp(' ## Installing: "psbind.m" (text)')
fout = fopen('psbind.m', 'w');
%function theResult = psbind(self)
%
%% psbind -- Bind a "ps" object to its handle.
%%  psbind(self) binds self, a "ps" object, to
%%   its handle.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 10-Dec-1999 15:03:28.
%% Updated    10-Dec-1999 15:03:28.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, help(mfilename), return, end
%
%theHandle = handle(self);
%
%u = [];
%u.ps_Self = self;
%u.ps_Data = [];
%u.ps_Data.Handle = theHandle;
%u.ps_Data.UserData = get(theHandle, 'UserData');
%
%set(theHandle, 'UserData', u)
%
%if nargout > 0
%	theResult = self;
%else
%	assignin('caller', 'ans', self)
%end
fclose(fout);

disp(' ## Installing: "psevent.m" (text)')
fout = fopen('psevent.m', 'w');
%function theResult = psevent(theEvent, theMessage)
%
%% psevent -- Gateway for "ps" events.
%%  psevent('theEvent', theMessage) calls the "doevent"
%%   method of the "ps" object associated with the gcbf
%%   (current-callback-figure), if any.
% 
%% Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without explicit written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 09-Dec-1999 02:31:41.
%% Updated    09-Dec-1999 02:31:41.
%
%if nargout > 0, theResult = []; end
%if nargin < 1, theEvent = 'Callback'; end
%if nargin < 2, theMessage = []; end
%
%if isempty(gcbf), return, end
%
%if nargout > 0
%	theResult = doevent(ps(gcbf), theEvent, theMessage);
%else
%	doevent(ps(gcbf), theEvent, theMessage);
%end
fclose(fout);

disp(' ## Installing: "setdef.m" (text)')
fout = fopen('setdef.m', 'w');
%function setdef(theFunction)
%
%% setdef -- Switch to directory of a function.
%%  setdef(theFunction) switches to the directory
%%   that contains theFunction.
%%  setdef (no argument) displays pwd.
%
%% Copyright (C) 1996 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without written consent from the
%%    copyright owner does not constitute publication.
%
%if nargin > 0
%   w = which(theFunction);
%   f = findstr(w, filesep);
%   if any(f)
%      w = w(1:f(length(f)));
%      eval(['cd(''' w(1:f(length(f))) ''')'])
%   end
%end
%disp([' ## ' pwd])
fclose(fout);

disp(' ## Installing: "super.m" (text)')
fout = fopen('super.m', 'w');
%function theSuperObject = super(theObject)
%
%% super -- Super-object of an object.
%%  super(theObject) returns the super-object
%%   of theObject, or [] if none exists.  The
%%   super-object is the bottom-most object
%%   in the struct of theObject, if any.
%
%% Copyright (C) 1996 Dr. Charles R. Denham, ZYDECO.
%%  All Rights Reserved.
%%   Disclosure without written consent from the
%%    copyright owner does not constitute publication.
% 
%% Version of 04-Apr-1997 16:51:36.
%% Revised    02-Nov-1998 08:26:00.
%
%if nargin < 1, help super, return, end
%
%if isobject(theObject)
%   theStruct = struct(theObject);
%  else
%   theStruct = theObject;
%end
%
%s = [];
%
%f = fieldnames(theStruct);
%if ~isempty(f)
%   s = getfield(theStruct, f{length(f)});
%   if ~isobject(s), s = []; end
%end
%
%if nargout > 0
%   theSuperObject = s;
%  else
%   disp(s)
%end
fclose(fout);
cd ('..')
disp(' ')
disp(' ## To get started, put the "presto" folder in your Matlab')
disp(' ##  path, then execute "ps_test" at the Matlab prompt.')