% Adjust the landscape parameters according to which method was chosen
% Calls:  Build
function [sz,iters,dim] = ChangeOptions(method,sz,iters,randm,peak,decay,dim,jag,water,menuH,win1H,win2H);

% If 'custom' was chosen, display the custom window
% Otherwise, set sz and iters appropriate to the method
% Also, adjust the sz and iters sliders in the main window, and record
% which method number was chosen
switch method
	case 'fractl',
		sz = 6;
		iters = 3;
		choice = 2;
		set(win1H(4),'SliderStep',[.5 1],...
   			'Min',4,'Max',6,...
			'Value',sz);
		set(win1H(7),'SliderStep',[.25 1],...
   			'Min',1,'Max',5,...
			'Value',iters);
	case 'subdiv',
		sz = 8;
		iters = 15;
		choice = 3;
		set(win1H(4),'SliderStep',[.2 1],...
   			'Min',6,'Max',11,...
			'Value',sz);
		set(win1H(7),'SliderStep',[.04 .2],...
   			'Min',1,'Max',26,...
			'Value',iters);
	case 'spline',
		sz = 10;
		iters = 15;
		choice = 4;
		set(win1H(4),'SliderStep',[.05 .2],...
   			'Min',5,'Max',25,...
			'Value',sz);
		set(win1H(7),'SliderStep',[.04 .2],...
   			'Min',1,'Max',26,...
			'Value',iters);
	case 'spplus',
		sz = 8;
		iters = 15;
		choice = 5;
		set(win1H(4),'SliderStep',[.2 1],...
   			'Min',6,'Max',11,...
			'Value',sz);
		set(win1H(7),'SliderStep',[.04 .2],...
   			'Min',1,'Max',26,...
			'Value',iters);
	case 'random',
		sz = 8;
		iters = 15;
		choice = 6;
		set(win1H(4),'SliderStep',[.2 1],...
   			'Min',6,'Max',11,...
			'Value',sz);
		set(win1H(7),'SliderStep',[.04 .2],...
   			'Min',1,'Max',26,...
			'Value',iters);
	case 'randsp',
		sz = 8;
		iters = 15;
		choice = 7;
		set(win1H(4),'SliderStep',[.2 1],...
   			'Min',6,'Max',11,...
			'Value',sz);
		set(win1H(7),'SliderStep',[.04 .2],...
   			'Min',1,'Max',26,...
			'Value',iters);
	case 'rndpls',
		sz = 8;
		iters = 15;
		choice = 8;
		set(win1H(4),'SliderStep',[.2 1],...
   			'Min',6,'Max',11,...
			'Value',sz);
		set(win1H(7),'SliderStep',[.04 .2],...
   			'Min',1,'Max',26,...
			'Value',iters);
	case 'custom',
		set(win2H(1),'Visible','on');
		choice = 9;
		set(win1H(4),'SliderStep',[.2 1],...
   			'Min',6,'Max',11,...
			'Value',sz);
		set(win1H(7),'SliderStep',[.04 .2],...
   			'Min',1,'Max',26,...
			'Value',iters);
	otherwise,
		sz = 15;
		iters = 15;
		choice = 1;
		set(win1H(4),'SliderStep',[.02 .1],...
   			'Min',5,'Max',55,...
			'Value',sz);
		set(win1H(7),'SliderStep',[.04 .2],...
   			'Min',1,'Max',26,...
			'Value',iters);
end

% Refresh the sz and iters displays in the main window
set(win1H(3),'String',num2str(sz));
set(win1H(6),'String',num2str(iters));

% Check only the menu item chosen
for i = 1:9
	set(menuH(i),'Checked','off');
end
set(menuH(choice),'Checked','on');

% If any method other than custom was chosen, create the landscape
if (method ~= 'custom') | (method == 'subdiv') | (method == 'random')
	[sz,iters,dim] = Build(method,sz,iters,randm,peak,decay,dim,2,30,0);
end
