%Copyright (c) 2010, Luuk J.G.W. van Wilderen
%
%load_fit_opts.m

%Show advanced options if 'Advanced'- radio button is selected
function load_fit_opts(source,eventdata)

if strcmp(get(get(source,'SelectedObject'),'String'),'Advanced')==1
    set(findobj('Tag','Alg_choice_toggle'),'visible','on')
    set(findobj('Tag','Alg_accuracy_toggle'),'visible','on')
    set(findobj('Tag','Alg_interpol_text'),'visible','on')
    set(findobj('Tag','Alg_interpol_box'),'visible','on')
    set(findobj('Tag','Disp_panel'),'visible','on')
    set(findobj('Tag','Disp_fitting_button'),'visible','on')
    set(findobj('Tag','dispersion_correction_toggle'),'visible','on')
    set(findobj('Tag','Load_Disp_button'),'visible','on')
    set(findobj('Tag','Par_fix_disp_toggle'),'Visible','on');
    set(findobj('Tag','time_zero_text'),'visible','off')
    set(findobj('Tag','time_zero_box'),'visible','off')
    set(findobj('Tag','OD_offset_text'),'visible','off')
    set(findobj('Tag','OD_offset_box'),'visible','off')
    set(findobj('Tag','Dispers_text'),'visible','on')
    set(findobj('Tag','Dispers_box'),'visible','on')
    set(findobj('Tag','IRF_text'),'visible','off')
    set(findobj('Tag','IRF_box'),'visible','off')
    set(findobj('Tag','par_fix_switch_toggle'),'visible','off')
    set(findobj('Tag','Par_fix_time_text'),'Visible','off');
    set(findobj('Tag','Par_fix_time_box'),'Visible','off');
    set(findobj('Tag','Par_fix_time_zero_toggle'),'Visible','off');
    set(findobj('Tag','Par_fix_OD_offset_toggle'),'Visible','off');
    set(findobj('Tag','Par_fix_IRF_toggle'),'Visible','off');
    set(findobj('Tag','Par_fix_spectra_matrix_text'),'Visible','off');
    set(findobj('Tag','Par_fix_spectra_matrix_box'),'Visible','off');
elseif strcmp(get(get(source,'SelectedObject'),'String'),'Fit parameters')==1
    set(findobj('Tag','Alg_choice_toggle'),'Visible','off');
    set(findobj('Tag','Alg_accuracy_toggle'),'Visible','off');
    set(findobj('Tag','Alg_interpol_text'),'visible','off')
    set(findobj('Tag','Alg_interpol_box'),'visible','off')
    set(findobj('Tag','Disp_panel'),'visible','off')
    set(findobj('Tag','Disp_fitting_button'),'visible','off')
    set(findobj('Tag','dispersion_correction_toggle'),'visible','off')
    set(findobj('Tag','Load_Disp_button'),'visible','off')
    set(findobj('Tag','Par_fix_disp_toggle'),'Visible','off');
    set(findobj('Tag','time_zero_text'),'visible','on')
    set(findobj('Tag','time_zero_box'),'visible','on')
    set(findobj('Tag','OD_offset_text'),'visible','on')
    set(findobj('Tag','OD_offset_box'),'visible','on')
    set(findobj('Tag','Dispers_text'),'visible','off')
    set(findobj('Tag','Dispers_box'),'visible','off')
    set(findobj('Tag','IRF_text'),'visible','on')
    set(findobj('Tag','IRF_box'),'visible','on')
    set(findobj('Tag','par_fix_switch_toggle'),'visible','on')
    if get(findobj('Tag','par_fix_switch_toggle'),'Value')==1
        set(findobj('Tag','Par_fix_time_text'),'Visible','on');
        set(findobj('Tag','Par_fix_time_box'),'Visible','on');
        set(findobj('Tag','Par_fix_time_zero_toggle'),'Visible','on');
        set(findobj('Tag','Par_fix_OD_offset_toggle'),'Visible','on');
        set(findobj('Tag','Par_fix_IRF_toggle'),'Visible','on');
        set(findobj('Tag','Par_fix_spectra_matrix_text'),'Visible','on');
        set(findobj('Tag','Par_fix_spectra_matrix_box'),'Visible','on');
    elseif get(findobj('Tag','par_fix_switch_toggle'),'Value')==0;
        set(findobj('Tag','Par_fix_time_text'),'Visible','off');
        set(findobj('Tag','Par_fix_time_box'),'Visible','off');
        set(findobj('Tag','Par_fix_time_zero_toggle'),'Visible','off');
        set(findobj('Tag','Par_fix_OD_offset_toggle'),'Visible','off');
        set(findobj('Tag','Par_fix_IRF_toggle'),'Visible','off');
        set(findobj('Tag','Par_fix_spectra_matrix_text'),'Visible','off');
        set(findobj('Tag','Par_fix_spectra_matrix_box'),'Visible','off');
    end
end

