function MakeInputSettings(fighandle)
% MakeInputSettings(FIGHANDLE)
%
% This function accepts the handle FIGHANDLE to the main GUI figure and
% updates the handles structure to reflect the current status of the input
% data. It is called every time a selection is made on the Input menu from
% the main GUI. 

% get handles structure from main GUI
handles=guidata(fighandle);

% make note of which dialogues have been completed
if isfield(handles,'prop')
    if isfield(handles.prop,'youngmodulus')
        yesprop=sprintf('Properties set.\n');
    else
        yesprop='';
    end
    if isfield(handles.prop,'twoDflag')
        if handles.prop.twoDflag==1
            yesopts=sprintf('Plane strain.\n');
        else
            yesopts=sprintf('Plane stress.\n');
        end
    else
        yesopts='';
    end
    if isfield(handles.prop,'bodyforce')
        yesbfs=sprintf('Body forces set.\n');
    else
        yesbfs='';
    end
else
    yesprop='';
    yesopts='';
    yesbfs='';
end

% make note of whether BC exist
if isfield(handles,'bcsi')
    yesbcs=sprintf('BCs set.\n');
else
    yesbcs='';
end

% see if an input file exists
if isfield(handles,'inputfile')
    handles.inputtext=handles.inputfile;
else
    handles.inputtext=[yesprop,yesbcs,yesbfs,yesopts];
end
if strcmp(handles.inputtext,'')
    handles=rmfield(handles,'inputtext');
end

% since the input has changed, any existing solutions are no longer valid.
% remove any invalid existing fields.
SETTINGSFILES={'solutionexists','postprocfile','sigeps',...
               'principals','effectives','fringes','displ'};
for i=1:length(SETTINGSFILES)
    if isfield(handles,SETTINGSFILES{i})
        handles=rmfield(handles,SETTINGSFILES{i});
    end
end

% update handles structure
guidata(fighandle,handles);
