% GUImake2Dmenu
% function for the MODIS GUI
% Copyright by Jasmine S Nahorniak, Oregon State University. 
% Feb 29 2000

function GUImake2Dmenu(GtwoDfig)

% ********************************************************
% menu contents and order

GUIdefaults;

% ********************************************************
% make menus

% ****************
% COLORS

h0=uimenu('Parent',GtwoDfig,'Callback','','Label','Colors');


% ****************
% line color

choices=guilinecolor;

colns=GUIcol2num(choices);

h1=uimenu('Parent',h0,'Callback','','Label','Line color');

for i=1:length(choices(:,1));
  colorcell=choices(i,:);
  color=cat(1,colorcell{:});   % convert cell to string
  numcol=['[' num2str(colns(i,:)) ']'];
  uimenu('Parent',h1, ...
	'Callback',['set(Glineh,''Color'',' numcol ');'], ...
	'Label',color)
end

% ****************
% background color

choices=guibackgroundcolors;

colns=GUIcol2num(choices);

h1=uimenu('Parent',h0,'Callback','','Label','Background color');

for i=1:length(choices(:,1));
  choicecell=choices(i,:);
  col=cat(1,choicecell{:});   % convert cell to string
  numcol=['[' num2str(colns(i,:)) ']'];
  uimenu('Parent',h1, ...
	'Callback',['set(gcbf,''Color'',' numcol '); set(gca,''Color'',' numcol ', ''XColor'',' numcol ',''YColor'',' numcol ',''ZColor'',' numcol ');'], ...
	'Label',col)
  end


% ****************
% axis/label color

choices=guiaxiscolors;

colns=GUIcol2num(choices);

h1=uimenu('Parent',h0,'Callback','','Label','Axis/label color');

for i=1:length(choices(:,1));
  choicecell=choices(i,:);
  col=cat(1,choicecell{:});   % convert cell to string
  numcol=['[' num2str(colns(i,:)) ']'];
  if col(1:3)=='non',  % is 'none'
     uimenu('Parent',h1, ...
	'Callback',['set(gca,''XColor'',get(gcbf,''Color''),''YColor'',get(gcbf,''Color'')); xlabel(''''); ylabel(''''); set(gca,''XTick'',[],''YTick'',[])'], ...
	'Label',col)
  else
     uimenu('Parent',h1, ...
	'Callback',['set(gca,''Xcolor'',' numcol ',''Ycolor'',' numcol '); set(get(gca,''Title''),''Color'',' numcol '); set(gca,''XTickMode'',''auto'',''YTickMode'',''auto'');'], ...
	'Label',col) 
  end
end



% ****************
% ****************
% axis type

choices=guiaxistype;

h1=uimenu('Parent',GtwoDfig,'Callback','','Label','Axis Type');
h2=uimenu('Parent',h1,'Callback','','Label','X axis');
h3=uimenu('Parent',h1,'Callback','','Label','Y axis');

for i=1:length(choices(:,1));
  colorcell=choices(i,:);
  axistype=cat(1,colorcell{:});   % convert cell to string
  uimenu('Parent',h2, ...
	'Callback',['set(gca,''XScale'', ''' axistype ''');'], ...
	'Label',axistype)
  uimenu('Parent',h3, ...
	'Callback',['set(gca,''YScale'', ''' axistype ''');'], ...
	'Label',axistype)
end

% ****************
% line type

choices=guilinetype;

h1=uimenu('Parent',GtwoDfig,'Callback','','Label','Line Type');

for i=1:length(choices(:,1));
  colorcell=choices(i,:);
  linetype=cat(1,colorcell{:});   % convert cell to string
  uimenu('Parent',h1, ...
	'Callback',['warning off; set(Glineh,''Marker'',''none'',''LineStyle'', ''' linetype '''); warning on;'], ...
	'Label',linetype)
end

% ****************
% grid

choices=guigrid;

h1=uimenu('Parent',GtwoDfig,'Callback','','Label','Grid');

for i=1:length(choices(:,1)),
  choicecell=choices(i,:);
  gridchoice=cat(1,choicecell{:});   % convert cell to string
  uimenu('Parent',h1, ...
	'Callback',['grid ' gridchoice ';'], ...
	'Label',gridchoice)
end


% ****************
% output figure

choices=guioutfig;

h1=uimenu('Parent',GtwoDfig,'Callback','','Label','Save Figure');

for i=1:length(choices(:,1)),
  choicecell=choices(i,:);
  outputchoice=cat(1,choicecell{:});   % convert cell to string
  uimenu('Parent',h1, ...
	'Callback',['GUIoutputfig(''' outputchoice ''')'], ...
	'Label',outputchoice)
end

% ***************
