function handles = GUI_enable_onoff(handles)
% This function en/disables stuff on the GUI of raPPPid depending on the
% activated settings
%
% INPUT:
%	handles         struct, from raPPPid GUI
% OUTPUT:
%	handles         struct, updated (e.g., Visiblity, Enable)
%
% Revision:
%   ...
%
% This function belongs to raPPPid, Copyright (c) 2023, M.F. Glaner
% *************************************************************************


batch_proc = handles.checkbox_batch_proc.Value;
proc_meth = handles.popupmenu_process.String(handles.popupmenu_process.Value);
bool_satellite = handles.checkbox_satellite.Value;
iono_model = handles.buttongroup_models_ionosphere.SelectedObject.String;
bool_DCM = strcmp(iono_model, 'Estimate, decoupled clock');
kinematic = handles.checkbox_kinematic.Value;

GPS_on = handles.checkbox_GPS.Value;
GLO_on = handles.checkbox_GLO.Value;
GAL_on = handles.checkbox_GAL.Value;
BDS_on = handles.checkbox_BDS.Value;
QZS_on = handles.checkbox_QZSS.Value;


% enable/disable Download button
set(handles.pushbutton_download,'Enable','Off');
if batch_proc || (isfield(handles, 'paths') && (~isempty(handles.paths.obs_1) || ~isempty(handles.paths.obs_2)))
    set(handles.pushbutton_download,'Enable','On');
end

% enable/disable Delete and Results button
set(handles.pushbutton_delete,  'Enable','Off');
set(handles.pushbutton_results, 'Enable','Off');
if isfield(handles, 'paths') && ~isempty(handles.paths.lastproc) && ...
        isfolder(handles.paths.lastproc)
    set(handles.pushbutton_delete,  'Enable','On');
    set(handles.pushbutton_results, 'Enable','On');
end




%% Input-File
if strcmp(handles.uipanel_setInputFile.Visible, 'on')
    
    % ||| implement at some point
    
    
    % disable stuff on this panel if batch processing is enabled
    onoff = 'On';
    if batch_proc
        onoff = 'Off';
    end
    % observation file
    set(handles.text_obs, 'Enable', onoff);
    set(handles.edit_obs, 'Enable', onoff);
    set(handles.pushbutton_obs_file, 'Enable', onoff);
	set(handles.pushbutton_analyze_rinex, 'Enable', onoff);
    % approximate coordinates
    set(handles.text_koord, 'Enable', onoff);
    set(handles.text_x, 'Enable', onoff);
    set(handles.text_y, 'Enable', onoff);
    set(handles.text_z, 'Enable', onoff);
    set(handles.edit_x, 'Enable', onoff);
    set(handles.edit_y, 'Enable', onoff);
    set(handles.edit_z, 'Enable', onoff);
    set(handles.text40, 'Enable', onoff);
    set(handles.text41, 'Enable', onoff);
    set(handles.text42, 'Enable', onoff);
    % processed GNSS and frequencies
    set(handles.text_proc_freq, 'Enable', onoff);
    set(handles.checkbox_GPS, 'Enable', onoff);
    set(handles.checkbox_GLO, 'Enable', onoff);
    set(handles.checkbox_GAL, 'Enable', onoff);
    set(handles.checkbox_BDS, 'Enable', onoff);
    set(handles.checkbox_QZSS, 'Enable', onoff);
    set(handles.popupmenu_gps_1, 'Enable', onoff);
    set(handles.popupmenu_gps_2, 'Enable', onoff);
    set(handles.popupmenu_gps_3, 'Enable', onoff);
    set(handles.popupmenu_glo_1, 'Enable', onoff);
    set(handles.popupmenu_glo_2, 'Enable', onoff);
    set(handles.popupmenu_glo_3, 'Enable', onoff);
    set(handles.popupmenu_gal_1, 'Enable', onoff);
    set(handles.popupmenu_gal_2, 'Enable', onoff);
    set(handles.popupmenu_gal_3, 'Enable', onoff);
    set(handles.popupmenu_bds_1, 'Enable', onoff);
    set(handles.popupmenu_bds_2, 'Enable', onoff);
    set(handles.popupmenu_bds_3, 'Enable', onoff);
    set(handles.popupmenu_qzss_1, 'Enable', onoff);
    set(handles.popupmenu_qzss_2, 'Enable', onoff);
    set(handles.popupmenu_qzss_3, 'Enable', onoff);    
    % observation ranking
    set(handles.text_rank, 'Enable', onoff);
    set(handles.edit_gps_rank, 'Enable', onoff);
    set(handles.edit_glo_rank, 'Enable', onoff);
    set(handles.edit_gal_rank, 'Enable', onoff);
    set(handles.edit_bds_rank, 'Enable', onoff);
    set(handles.edit_qzss_rank, 'Enable', onoff);
    % realtime processing
    set(handles.checkbox_realtime, 'Enable', onoff);
    set(handles.edit_RT_from, 'Enable', onoff);
    set(handles.edit_RT_to, 'Enable', onoff);
    set(handles.text_RT_from, 'Enable', onoff);
    set(handles.text_RT_to, 'Enable', onoff);
    set(handles.text_RT_format, 'Enable', onoff);
    % analyze
    set(handles.pushbutton_analyze_rinex, 'Enable', onoff);
    
    
    % En/disable items for each GNSS 
    if ~batch_proc
        % Checkbox GPS
        handles.checkbox_GPS.Enable = 'On';
        if GPS_on       % GPS processing enabled
            set(handles.popupmenu_gps_1,                     'Enable', 'On');
            set(handles.popupmenu_gps_2,                     'Enable', 'On');
            set(handles.popupmenu_gps_3,                     'Enable', 'On');
            set(handles.edit_gps_rank,                       'Enable', 'On');
            handles.edit_filter_rec_clock_sigma0.Enable = 'On';
            handles.edit_filter_rec_clock_Q.Enable = 'On';
            handles.popupmenu_filter_rec_clock_dynmodel.Enable = 'On';
            handles.text_gps_time_offset.Enable = 'On';
            handles.text_gps_time_offset_m.Enable = 'On';
        else
            set(handles.popupmenu_gps_1,                     'Enable', 'Off');
            set(handles.popupmenu_gps_2,                     'Enable', 'Off');
            set(handles.popupmenu_gps_3,                     'Enable', 'Off');
            set(handles.edit_gps_rank,                       'Enable', 'Off');
            handles.edit_filter_rec_clock_sigma0.Enable = 'Off';
            handles.edit_filter_rec_clock_Q.Enable = 'Off';
            handles.popupmenu_filter_rec_clock_dynmodel.Enable = 'Off';
            handles.text_gps_time_offset.Enable = 'Off';
            handles.text_gps_time_offset_m.Enable = 'Off';
        end
        % Checkbox Glonass
        handles.checkbox_GLO.Enable = 'On';
        if GLO_on       % GLONASS processing enabled
            set(handles.popupmenu_glo_1,                     'Enable', 'On');
            set(handles.popupmenu_glo_2,                     'Enable', 'On');
            set(handles.popupmenu_glo_3,                     'Enable', 'On');
            set(handles.edit_glo_rank,                       'Enable', 'On');
            handles.edit_filter_glonass_offset_sigma0.Enable = 'On';
            handles.edit_filter_glonass_offset_Q.Enable = 'On';
            handles.popupmenu_filter_glonass_offset_dynmodel.Enable = 'On';
            handles.text_glo_time_offset.Enable = 'On';
            handles.text_glo_time_offset_m.Enable = 'On';
        else
            set(handles.popupmenu_glo_1,                     'Enable', 'Off');
            set(handles.popupmenu_glo_2,                     'Enable', 'Off');
            set(handles.popupmenu_glo_3,                     'Enable', 'Off');
            set(handles.edit_glo_rank,                       'Enable', 'Off');
            handles.edit_filter_glonass_offset_sigma0.Enable = 'Off';
            handles.edit_filter_glonass_offset_Q.Enable = 'Off';
            handles.popupmenu_filter_glonass_offset_dynmodel.Enable = 'Off';
            handles.text_glo_time_offset.Enable = 'Off';
            handles.text_glo_time_offset_m.Enable = 'Off';
        end
        % Checkbox Galileo
        handles.checkbox_GAL.Enable = 'On';
        if GAL_on       % Galileo processing enabled
            set(handles.popupmenu_gal_1,                     'Enable', 'On');
            set(handles.popupmenu_gal_2,                     'Enable', 'On');
            set(handles.popupmenu_gal_3,                     'Enable', 'On');
            set(handles.edit_gal_rank,                       'Enable', 'On');
            handles.edit_filter_galileo_offset_sigma0.Enable = 'On';
            handles.edit_filter_galileo_offset_Q.Enable = 'On';
            handles.popupmenu_filter_galileo_offset_dynmodel.Enable = 'On';
            handles.text_gal_time_offset.Enable = 'On';
            handles.text_gal_time_offset_m.Enable = 'On';
        else
            set(handles.popupmenu_gal_1,                     'Enable', 'Off');
            set(handles.popupmenu_gal_2,                     'Enable', 'Off');
            set(handles.popupmenu_gal_3,                     'Enable', 'Off');
                set(handles.edit_gal_rank,                       'Enable', 'Off');
            handles.edit_filter_galileo_offset_sigma0.Enable = 'Off';
            handles.edit_filter_galileo_offset_Q.Enable = 'Off';
            handles.popupmenu_filter_galileo_offset_dynmodel.Enable = 'Off';
            handles.text_gal_time_offset.Enable = 'Off';
            handles.text_gal_time_offset_m.Enable = 'Off';
        end
        % Checkbox BeiDou
        handles.checkbox_BDS.Enable = 'On';
        if BDS_on       % BeiDou processing enabled
            set(handles.popupmenu_bds_1,                     'Enable', 'On');
            set(handles.popupmenu_bds_2,                     'Enable', 'On');
            set(handles.popupmenu_bds_3,                     'Enable', 'On');
            set(handles.edit_bds_rank,                       'Enable', 'On');
            handles.edit_filter_beidou_offset_sigma0.Enable = 'On';
            handles.edit_filter_beidou_offset_Q.Enable = 'On';
            handles.popupmenu_filter_beidou_offset_dynmodel.Enable = 'On';
            handles.text_bds_time_offset.Enable = 'On';
            handles.text_bds_time_offset_m.Enable = 'On';
        else
            set(handles.popupmenu_bds_1,                     'Enable', 'Off');
            set(handles.popupmenu_bds_2,                     'Enable', 'Off');
            set(handles.popupmenu_bds_3,                     'Enable', 'Off');
            set(handles.edit_bds_rank,                       'Enable', 'Off');
            handles.edit_filter_beidou_offset_sigma0.Enable = 'Off';
            handles.edit_filter_beidou_offset_Q.Enable = 'Off';
            handles.popupmenu_filter_beidou_offset_dynmodel.Enable = 'Off';
            handles.text_bds_time_offset.Enable = 'Off';
            handles.text_bds_time_offset_m.Enable = 'Off';
        end
        % Checkbox QZSS
        handles.checkbox_QZSS.Enable = 'On';
        if handles.checkbox_QZSS.Value       % BeiDou processing enabled
            set(handles.popupmenu_qzss_1,                     'Enable', 'On');
            set(handles.popupmenu_qzss_2,                     'Enable', 'On');
            set(handles.popupmenu_qzss_3,                     'Enable', 'On');
            set(handles.edit_qzss_rank,                       'Enable', 'On');
            handles.edit_filter_qzss_offset_sigma0.Enable = 'On';
            handles.edit_filter_qzss_offset_Q.Enable = 'On';
            handles.popupmenu_filter_qzss_offset_dynmodel.Enable = 'On';
            handles.text_qzss_time_offset.Enable = 'On';
            handles.text_qzss_time_offset_m.Enable = 'On';
        else
            set(handles.popupmenu_qzss_1,                     'Enable', 'Off');
            set(handles.popupmenu_qzss_2,                     'Enable', 'Off');
            set(handles.popupmenu_qzss_3,                     'Enable', 'Off');
            set(handles.edit_qzss_rank,                       'Enable', 'Off');
            handles.edit_filter_qzss_offset_sigma0.Enable = 'Off';
            handles.edit_filter_qzss_offset_Q.Enable = 'Off';
            handles.popupmenu_filter_qzss_offset_dynmodel.Enable = 'Off';
            handles.text_qzss_time_offset.Enable = 'Off';
            handles.text_qzss_time_offset_m.Enable = 'Off';
        end        
    end

    % approximate position is not used for satellite PPP
    if ~batch_proc && bool_satellite
        set(handles.text_koord, 'Enable', 'Off');
        set(handles.text_x, 'Enable', 'Off');
        set(handles.text_y, 'Enable', 'Off');
        set(handles.text_z, 'Enable', 'Off');
        set(handles.edit_x, 'Enable', 'Off');
        set(handles.edit_y, 'Enable', 'Off');
        set(handles.edit_z, 'Enable', 'Off');
        set(handles.text40, 'Enable', 'Off');
        set(handles.text41, 'Enable', 'Off');
        set(handles.text42, 'Enable', 'Off');
    end
    
    % analyze RINEX is only possible if observation file is defined
    if strcmpi(handles.pushbutton_analyze_rinex.Enable, 'on')
        set(handles.pushbutton_analyze_rinex, 'Enable', 'Off');
        if ~isempty(handles.edit_obs.String)
            set(handles.pushbutton_analyze_rinex, 'Enable', 'On');
        end
    end
    
    % real-time processing is en/disabled
    onoff = 'Off';
    if handles.checkbox_realtime.Value && ~handles.checkbox_batch_proc.Value
        onoff = 'On'; 
    end
    handles.edit_RT_from.Enable   = onoff; handles.edit_RT_from.Visible   = onoff;
    handles.edit_RT_to.Enable     = onoff; handles.edit_RT_to.Visible     = onoff;
    handles.text_RT_from.Enable   = onoff; handles.text_RT_from.Visible   = onoff;
    handles.text_RT_to.Enable     = onoff; handles.text_RT_to.Visible     = onoff;
    handles.text_RT_format.Enable = onoff; handles.text_RT_format.Visible = onoff;
    
    
end         % end of panel "Input-File"



%% Orbit/Clock-Data
if strcmp(handles.uipanel_orbitClockData.Visible, 'on')
    string_all = handles.popupmenu_prec_prod.String;
    prec_prod_source = string_all{handles.popupmenu_prec_prod.Value};
    
    % precise products are selected manually
    if strcmpi(prec_prod_source,'manually')
        set(handles.text_sp3,'Visible','on');
        set(handles.edit_sp3,'Visible','on');
        set(handles.pushbutton_sp3,'Visible','on');
        set(handles.text_clock,'Visible','on');
        set(handles.edit_clock,'Visible','on');
        set(handles.pushbutton_clock,'Visible','on');
        set(handles.text_obx,'Visible','on');
        set(handles.edit_obx,'Visible','on');
        set(handles.pushbutton_obx,'Visible','on');		
    else
        set(handles.text_sp3,'Visible','off');
        set(handles.edit_sp3,'Visible','off');
        set(handles.pushbutton_sp3,'Visible','off');
        set(handles.text_clock,'Visible','off');
        set(handles.edit_clock,'Visible','off');
        set(handles.pushbutton_clock,'Visible','off');
        set(handles.text_obx,'Visible','off');
        set(handles.edit_obx,'Visible','off');
        set(handles.pushbutton_obx,'Visible','off');        
    end
    
    % precise products are selected
    if handles.radiobutton_prec_prod.Value
        handles.uibuttongroup_prec_prod_type.Visible = 'On';
        handles = VisibilityPreciseProducts(handles);
    else
        handles.uibuttongroup_prec_prod_type.Visible = 'Off';
    end
    
    % en/disable Single-GNSS Navigation Files
    onoff = 'Off';
    if handles.radiobutton_brdc_corr.Value && handles.radiobutton_single_nav.Value
        onoff = 'On';
    end
    set(handles.text191,                'Enable', onoff);
    set(handles.edit_nav_GPS,         	'Enable', onoff);
    set(handles.pushbutton_nav_GPS,  	'Enable', onoff);
    set(handles.text190,                'Enable', onoff);
    set(handles.edit_nav_GLO,          	'Enable', onoff);
    set(handles.pushbutton_nav_GLO,  	'Enable', onoff);
    set(handles.text192,                'Enable', onoff);
    set(handles.edit_nav_GAL,        	'Enable', onoff);
    set(handles.pushbutton_nav_GAL, 	'Enable', onoff);
    set(handles.text281,                'Enable', onoff);
    set(handles.edit_nav_BDS,        	'Enable', onoff);
    set(handles.pushbutton_nav_BDS, 	'Enable', onoff);
    
    % en/disable stuff depending on "use ORBEX" checkbox
    if handles.checkbox_obx.Value; onoff = 'On'; else onoff = 'Off'; end
    set(handles.text_obx,       'Enable', onoff)
    set(handles.edit_obx,       'Enable', onoff)
    set(handles.pushbutton_obx, 'Enable', onoff)
    
    % check if correction stream is manually selected. Then check if to show 
    % correction age limit and stream reference point
    set(handles.edit_corr2brdc_age, 'Visible', 'Off');
    set(handles.text_corr2brdc_age_1, 'Visible', 'Off');
    set(handles.text_corr2brdc_age_2, 'Visible', 'Off');
    set(handles.uibuttongroup_CorrStreamRef, 'Visible', 'Off');
    value = get(handles.popupmenu_CorrectionStream, 'Value');
    string_all = get(handles.popupmenu_CorrectionStream, 'String');
    corr_stream = string_all{value};
    if handles.radiobutton_brdc_corr.Value && strcmp(corr_stream, 'manually')
        set(handles.edit_corr2brdc_age, 'Visible', 'On');
        set(handles.text_corr2brdc_age_1, 'Visible', 'On');
        set(handles.text_corr2brdc_age_2, 'Visible', 'On');
        set(handles.uibuttongroup_CorrStreamRef, 'Visible', 'On');
    end
    
    
end



%% Ionosphere
if strcmpi(handles.uipanel_ionosphere.Visible, 'on')
    set(handles.buttongroup_models_ionosphere_autodetect,'Visible','Off');
    set(handles.buttongroup_models_ionosphere_ionex_type,'Visible','Off');
    switch iono_model
        case {'2-Frequency-IF-LCs', '3-Frequency-IF-LC', 'Estimate', 'GRAPHIC', 'off', 'Estimate, decoupled clock'}
            set(handles.buttongroup_source_ionosphere,'Visible','Off');
            set(handles.buttongroup_models_ionosphere_ionex,'Visible','Off');
            set(handles.buttongroup_models_ionosphere_autodetect,'Visible','Off');
            set(handles.buttongroup_models_ionosphere_ionex_type,'Visible','Off');
            
        case {'Estimate with ... as constraint', 'Correct with ...'}
            set(handles.buttongroup_source_ionosphere,'Visible','On');
            if strcmp(handles.buttongroup_source_ionosphere.SelectedObject.String, 'IONEX File')
                set(handles.buttongroup_models_ionosphere_ionex,'Visible','On');
                set(handles.buttongroup_models_ionosphere_ionex_type,'Visible','Off');
                set(handles.buttongroup_models_ionosphere_autodetect,'Visible','Off');
                set(handles.edit_iono_autodetect,'Enable','Off');
                set(handles.edit_ionex,      'Enable','Off');
                set(handles.pushbutton_ionex,'Enable','Off');
                set(handles.text_iono_interpol,            'Visible', 'On');
                set(handles.popupmenu_iono_interpol,            'Visible', 'On');
                switch handles.buttongroup_models_ionosphere_ionex.SelectedObject.String
                    case 'Source:'
                        set(handles.buttongroup_models_ionosphere_ionex_type,'Visible','On');
                        handles = VisibilityIonexProductType(handles);
                    case 'Auto-Detection:'
                        set(handles.buttongroup_models_ionosphere_autodetect,'Visible','On');
                        set(handles.edit_iono_autodetect,'Enable','On');
                    case 'manually:'
                        set(handles.edit_ionex,      'Enable','On');
                        set(handles.pushbutton_ionex,'Enable','On');
                end
            else
                set(handles.buttongroup_models_ionosphere_ionex,'Visible','Off');
                set(handles.buttongroup_models_ionosphere_autodetect,'Visible','Off');
                set(handles.buttongroup_models_ionosphere_ionex_type,'Visible','Off');
                set(handles.text_iono_interpol,            'Visible', 'Off');
                set(handles.popupmenu_iono_interpol,            'Visible', 'Off');
            end
    end
end



%% Troposphere
if strcmpi(handles.uipanel_troposphere.Visible, 'on')
    % set everything to invisible
    set(handles.popupmenu_tropo_file,'Visible','off');
    set(handles.edit_tropo_file,'Visible','off');
    set(handles.pushbutton_tropo_file,'Visible','off');
    set(handles.text_temp,'Visible','off');
    set(handles.text_feuchte,'Visible','off');
    set(handles.text_druck,'Visible','off');
    set(handles.edit_temp,'Visible','off');
    set(handles.edit_feuchte,'Visible','off');
    set(handles.edit_druck,'Visible','off');
    set(handles.text_vmf_version,'Visible','off');
    set(handles.popupmenu_vmf_type,'Visible','off');
    
    % Hydrostatic
    switch handles.buttongroup_models_troposphere_zhd.SelectedObject.String
        case {'p(GPT3) + Saastamoinen', 'no'}
            % nothing to do here
        case {'VMF3', 'VMF1'}
            set(handles.text_vmf_version,'Visible','on');
            set(handles.popupmenu_vmf_type,'Visible','on');
        case 'Tropo file'
            set(handles.popupmenu_tropo_file,'Visible','on');
            if strcmp('manually', handles.popupmenu_tropo_file.String(handles.popupmenu_tropo_file.Value))
                set(handles.edit_tropo_file,'Visible','on');
                set(handles.pushbutton_tropo_file,'Visible','on');
            end   
        case 'p (in situ) + Saastamoinen'
            set(handles.text_druck,'Visible','on');
            set(handles.edit_druck,'Visible','on');
    end
    
    % Wet
    switch handles.buttongroup_models_troposphere_zwd.SelectedObject.String
        case {'e(GPT3) + Askne', 'no'}
            % nothing to do here
        case {'VMF3', 'VMF1'}
            set(handles.text_vmf_version,'Visible','on');
            set(handles.popupmenu_vmf_type,'Visible','on');
        case 'Tropo file'
            set(handles.popupmenu_tropo_file,'Visible','on');
            if strcmp('manually', handles.popupmenu_tropo_file.String(handles.popupmenu_tropo_file.Value))
                set(handles.edit_tropo_file,'Visible','on');
                set(handles.pushbutton_tropo_file,'Visible','on');
            end
        case 'e (in situ) + Askne'
            set(handles.text_temp,'Visible',   'on');
            set(handles.text_feuchte,'Visible','on');
            set(handles.edit_temp,'Visible',   'on');
            set(handles.edit_feuchte,'Visible','on');
    end
    
    % hydrostatic mapping function
    switch handles.buttongroup_models_troposphere_mfh.SelectedObject.String
        case {'VMF3', 'VMF1'}
            set(handles.text_vmf_version,'Visible','on');
            set(handles.popupmenu_vmf_type,'Visible','on');
    end
    
    % wet mapping function
    switch handles.buttongroup_models_troposphere_mfw.SelectedObject.String
        case {'VMF3', 'VMF1'}
            set(handles.text_vmf_version,'Visible','on');
            set(handles.popupmenu_vmf_type,'Visible','on');
    end
    
    % hydrostatic gradient
    switch handles.buttongroup_models_troposphere_Gh.SelectedObject.String
        case {'GRAD'}
            set(handles.text_vmf_version,'Visible','on');
            set(handles.popupmenu_vmf_type,'Visible','on');
    end
    
    % wet gradient
    switch handles.buttongroup_models_troposphere_Gw.SelectedObject.String
        case {'GRAD'}
            set(handles.text_vmf_version,'Visible','on');
            set(handles.popupmenu_vmf_type,'Visible','on');
    end
    
    
    
    % ||| could be removed?!?!
    % estimate ZWD
    onoff = 'Off';
    if get(handles.checkbox_estimate_ZWD, 'Value')
        onoff = 'On';
    end
    handles.text_est_zwd_from.Visible = onoff;
    handles.edit_est_zwd_from.Visible = onoff;
end



%% Other Corrections
if strcmpi(handles.uipanel_otherCorrections.Visible, 'on')
    
    % disable satellite PCO and PCV for stream with APC as reference point
        handles.checkbox_sat_pco.Enable = 'on';
        handles.checkbox_sat_pcv.Enable = 'on';    
    if handles.radiobutton_brdc_corr.Value && handles.radiobutton_APC.Value && ...
            contains(handles.popupmenu_CorrectionStream.String{handles.popupmenu_CorrectionStream.Value}, 'manually')
        handles.checkbox_sat_pco.Enable = 'off';
        handles.checkbox_sat_pcv.Enable = 'off';
    end
    
    % ANTEX-File
    if strcmp(handles.uibuttongroup_antex.SelectedObject.String, 'Manual choice:')
        handles.pushbutton_antex.Enable = 'On';
        handles.edit_antex.Enable = 'On';
    else
        handles.pushbutton_antex.Enable = 'Off';
        handles.edit_antex.Enable = 'Off';
    end
    if ~handles.checkbox_sat_pco.Value && ~handles.checkbox_sat_pcv.Value && ...
            ~handles.checkbox_rec_pco.Value && ~handles.checkbox_rec_pcv.Value
        handles.uibuttongroup_antex.Visible = 'off';
    else
        handles.uibuttongroup_antex.Visible = 'on';
    end
    
    % disable eclipse condition checkbox depending on ORBEX use
    handles.checkbox_eclipse.Enable = 'on';
    if handles.checkbox_obx.Value
        handles.checkbox_eclipse.Enable = 'off';
    end
    
    % Cycle-Slip Detection is not relevant for code only processing
    if contains(proc_meth, '+ Phase');   onoff = 'On';   else;   onoff = 'Off';   end
    handles.text117.Enable = onoff;                         
    handles.checkbox_CycleSlip_L1C1.Enable = onoff;         % code minus phase
    handles.text116.Enable = onoff;
    handles.edit_CycleSlip_L1C1_threshold.Enable = onoff;   
    handles.text115.Enable = onoff;
    handles.edit_CycleSlip_L1C1_window.Enable = onoff;
    handles.checkbox_CycleSlip_DF.Enable = onoff;           % dLi - dLj
    handles.text120.Enable = onoff;
    handles.edit_CycleSlip_DF_threshold.Enable = onoff;
    handles.checkbox_CycleSlip_Doppler.Enable = onoff;      % Doppler
    handles.text182.Enable = onoff;
    handles.edit_CycleSlip_Doppler_threshold.Enable = onoff;
    handles.checkbox_wind_up.Enable = onoff;
    handles.checkbox_cs_td.Enable = onoff;          % time difference
    handles.text_cs_td_thresh.Enable = onoff;
    handles.edit_cs_td_thresh.Enable = onoff;
    handles.text_cs_td_degree.Enable = onoff;
    handles.edit_cs_td_degree.Enable = onoff;
    handles.checkbox_cs_HMW.Enable = onoff;         % HMW
    handles.text_cs_HMW_thresh.Enable = onoff;
    handles.edit_cs_HMW_thresh.Enable = onoff;
    handles.text_cs_HMW_factor.Enable = onoff;
    handles.edit_cs_HMW_factor.Enable = onoff;
    handles.checkbox_LLI.Enable = onoff;            % LLI
    

    % en/disable Antenna Reference Point correction in the case of kinematic processing
    if kinematic
        handles.checkbox_rec_ARP.Enable = 'off';
    else
        handles.checkbox_rec_ARP.Enable = 'on';
    end


    % ||| implement at some point
    
end



%% Kinematic
if strcmpi(handles.uipanel_kinematic.Visible, 'on')



    % Offsets
    if kinematic
        handles.checkbox_offsets.Enable   = 'On';
        handles.uibuttongroup_orientation_mode.Enable = 'On';
    else
        handles.checkbox_offsets.Enable   = 'Off';
        handles.uibuttongroup_orientation_mode.Enable = 'Off';
    end
    if kinematic && handles.checkbox_offsets.Value
        handles.text_offset_x.Enable  = 'On';
        handles.text_offset_y.Enable  = 'On';
        handles.text_offset_z.Enable  = 'On';
        handles.edit_offset_x.Enable  = 'On';
        handles.edit_offset_y.Enable  = 'On';
        handles.edit_offset_z.Enable  = 'On';
    else
        handles.text_offset_x.Enable  = 'Off';
        handles.text_offset_y.Enable  = 'Off';
        handles.text_offset_z.Enable  = 'Off';
        handles.edit_offset_x.Enable  = 'Off';
        handles.edit_offset_y.Enable  = 'Off';
        handles.edit_offset_z.Enable  = 'Off';
    end

    % Satellite PPP
    if bool_satellite && kinematic
        handles.text_sat_id.Visible    = 'On';
        handles.edit_sat_id.Visible    = 'On';
        handles.text_sat_mass.Visible  = 'On';
        handles.edit_sat_mass.Visible  = 'On';
        handles.text_sat_area.Visible  = 'On';
        handles.edit_sat_area.Visible  = 'On';
        handles.text_sat_drag.Visible  = 'On';
        handles.edit_sat_drag.Visible  = 'On';
        handles.text_sat_solar.Visible = 'On';
        handles.edit_sat_solar.Visible = 'On';
        handles.radiobutton_or_yaw.Enable	= 'On';
        handles.radiobutton_or_earth.Enable	= 'On';
        handles.radiobutton_or_orbex.Enable	= 'On';
    else
        handles.text_sat_id.Visible    = 'Off';
        handles.edit_sat_id.Visible    = 'Off';
        handles.text_sat_mass.Visible  = 'Off';
        handles.edit_sat_mass.Visible  = 'Off';
        handles.text_sat_area.Visible  = 'Off';
        handles.edit_sat_area.Visible  = 'Off';
        handles.text_sat_drag.Visible  = 'Off';
        handles.edit_sat_drag.Visible  = 'Off';
        handles.text_sat_solar.Visible = 'Off';
        handles.edit_sat_solar.Visible = 'Off';
        handles.radiobutton_or_yaw.Enable	= 'Off';
        handles.radiobutton_or_earth.Enable	= 'Off';
        handles.radiobutton_or_orbex.Enable	= 'Off';
    end

end


%% Biases
if strcmpi(handles.uipanel_biases.Visible, 'on')
    
    % ||| implement at some point
    
    % Manual source of code biases
    if handles.radiobutton_models_biases_code_manually.Value
        handles.buttongroup_models_biases_code_manually.Visible = 'On';
    else
        handles.buttongroup_models_biases_code_manually.Visible = 'Off';
    end
    
    if strcmp(handles.buttongroup_models_biases_code_manually.SelectedObject.String, 'Sinex-Bias-File')
        set(handles.edit_bias,      'Enable','On');
        set(handles.pushbutton_bias,'Enable','On');
    else
        set(handles.edit_bias,      'Enable','Off');
        set(handles.pushbutton_bias,'Enable','Off');
    end
    
    if strcmp(handles.buttongroup_models_biases_code_manually.SelectedObject.String, '*.DCB-File')
        set(handles.text_dcb_P1P2,      'Enable','On');
        set(handles.edit_dcb_P1P2,      'Enable','On');
        set(handles.pushbutton_dcb_P1P2,'Enable','On');
        set(handles.text_dcb_P1C1,      'Enable','On');
        set(handles.edit_dcb_P1C1,      'Enable','On');
        set(handles.pushbutton_dcb_P1C1,'Enable','On');
        set(handles.text_dcb_P2C2,      'Enable','On');
        set(handles.edit_dcb_P2C2,      'Enable','On');
        set(handles.pushbutton_dcb_P2C2,'Enable','On');
    else
        set(handles.text_dcb_P1P2,      'Enable','Off');
        set(handles.edit_dcb_P1P2,      'Enable','Off');
        set(handles.pushbutton_dcb_P1P2,'Enable','Off');
        set(handles.text_dcb_P1C1,      'Enable','Off');
        set(handles.edit_dcb_P1C1,      'Enable','Off');
        set(handles.pushbutton_dcb_P1C1,'Enable','Off');
        set(handles.text_dcb_P2C2,      'Enable','Off');
        set(handles.edit_dcb_P2C2,      'Enable','Off');
        set(handles.pushbutton_dcb_P2C2,'Enable','Off');
    end
    
    % check if biases from correction stream should be enabled
    stream = handles.popupmenu_CorrectionStream.String(handles.popupmenu_CorrectionStream.Value);
    if ~strcmp(stream, 'off') && handles.radiobutton_brdc_corr.Value
        % enable correction stream selection 
        set(handles.buttongroup_models_biases_phase,       'Visible', 'On');
        set(handles.radiobutton_models_biases_code_CorrectionStream,  'Enable', 'On');
        set(handles.radiobutton_models_biases_phase_CorrectionStream, 'Enable', 'On')
    else        % disable correction stream selection
        set(handles.buttongroup_models_biases_phase,       'Visible', 'Off');
        set(handles.radiobutton_models_biases_code_CorrectionStream,  'Enable', 'Off');
        set(handles.radiobutton_models_biases_phase_CorrectionStream, 'Enable', 'Off')
    end    
    
end


%% PPP-AR
if strcmpi(handles.uipanel_ambiguityFixing.Visible, 'on')
    
    % ||| implement at some point
    
    onoff = 'Off';
    if handles.checkbox_fixing.Value     % PPPAR is on
        onoff = 'On';
    end
    
    
    handles.checkbox_reset_fixed.Enable = onoff;        % Panel "Processing"
    
    % start of fixing
    handles.text_start_WL.Visible = onoff;
    handles.text_start_NL.Visible = onoff;
    handles.edit_start_WL.Visible = onoff;
    handles.edit_start_NL.Visible = onoff;
    
    % elevation cutoff for integer fixing
    set(handles.text_pppar_cutoff, 'Visible',onoff);
    set(handles.edit_pppar_cutoff, 'Visible',onoff);
    
    % choice of reference satellite
    handles.uibuttongroup_refSat.Visible = onoff;
    if bool_DCM && handles.checkbox_fixing.Value
        handles.uibuttongroup_refSat.Visible = 'On';
    end
    % manual choice of reference satellite
    handles.text_refSatGPS.Enable = 'Off';
    handles.text_refSatGLO.Enable = 'Off';
    handles.text_refSatGAL.Enable = 'Off';
    handles.text_refSatBDS.Enable = 'Off';
    handles.text_refSatQZS.Enable = 'Off';
    handles.edit_refSatGPS.Enable = 'Off';
    handles.edit_refSatGLO.Enable = 'Off';
    handles.edit_refSatGAL.Enable = 'Off';
    handles.edit_refSatBDS.Enable = 'Off';
    handles.edit_refSatQZS.Enable = 'Off';
    if strcmp(handles.uibuttongroup_refSat.SelectedObject.String, 'manual choice (list):')
        if GPS_on
            handles.text_refSatGPS.Enable = 'On';
            handles.edit_refSatGPS.Enable = 'On';
        end
        if GLO_on
            handles.text_refSatGLO.Enable = 'On';
            handles.edit_refSatGLO.Enable = 'On';
        end
        if GAL_on
            handles.text_refSatGAL.Enable = 'On';
            handles.edit_refSatGAL.Enable = 'On';
        end
        if BDS_on
            handles.text_refSatBDS.Enable = 'On';
            handles.edit_refSatBDS.Enable = 'On';
        end
        if QZS_on
            handles.text_refSatQZS.Enable = 'On';
            handles.edit_refSatQZS.Enable = 'On';
        end
    end
    
    % handles.uibuttongroup_wrongFixes.Visible = onoff;
    handles.text_pppar_excl_sats.Visible = onoff;
    handles.edit_pppar_excl_sats.Visible = onoff;
    
    % HMW fixing options
    handles.text_hmw_fixing.Visible = onoff;
    handles.text_hmw_release.Visible = onoff;
    handles.text_fixing_window.Visible = onoff;
    handles.text_hmw_thresh.Visible = onoff;
    handles.edit_hmw_release.Visible = onoff;
    handles.edit_fixing_window.Visible = onoff;
    handles.edit_hmw_thresh.Visible = onoff;
    
    % show fixing start depending on ionosphere processing model
    if bool_DCM
        handles.text_start_WL.String = 'Start Fixing after [s]';
        handles.text_start_NL.Visible = 'Off';
        handles.edit_start_NL.Visible = 'Off';
    else
        handles.text_start_WL.String = 'Start WL-Fixing after [s]';
    end
    
    % do not show options of HMW Fixing for decoupled clock model
    if bool_DCM
        OnOff = 'Off';
        handles.text_hmw_fixing.Visible    = OnOff;
        handles.edit_hmw_thresh.Visible    = OnOff;
        handles.text_hmw_thresh.Visible    = OnOff;
        handles.edit_hmw_release.Visible   = OnOff;
        handles.text_hmw_release.Visible   = OnOff;
        handles.edit_fixing_window.Visible = OnOff;
        handles.text_fixing_window.Visible = OnOff;
    end

end



%% Adjustment/Filter
if strcmpi(handles.uipanel_adjustment.Visible, 'on')
    % check if filter is enabled
    filter_sett = handles.popupmenu_filter.String(handles.popupmenu_filter.Value);
    if strcmpi(filter_sett,'No Filter')
        set(handles.uipanel_filter, 'Visible', 'off');
    else
        set(handles.uipanel_filter, 'Visible', 'on');
    end

    % estimation of velocity
    if bool_satellite || kinematic || contains(proc_meth, '+ Doppler')
        handles.text_velocity.Enable = 'On';
        handles.edit_filter_velocity_sigma0.Enable = 'On';
        handles.edit_filter_velocity_Q.Enable = 'On';
        handles.text_velocity_m.Enable = 'On';
        handles.popupmenu_filter_velocity_dynmodel.Enable = 'On';
    else
        handles.text_velocity.Enable = 'Off';
        handles.edit_filter_velocity_sigma0.Enable = 'Off';
        handles.edit_filter_velocity_Q.Enable = 'Off';
        handles.text_velocity_m.Enable = 'Off';
        handles.popupmenu_filter_velocity_dynmodel.Enable = 'Off';
    end
    
    % estimation of ZWD
    if handles.checkbox_estimate_ZWD.Value
        handles.text_zwd.Enable = 'On';
        handles.edit_filter_zwd_sigma0.Enable = 'On';
        handles.edit_filter_zwd_Q.Enable = 'On';
        handles.text_zwd_m.Enable = 'On';
        handles.popupmenu_filter_zwd_dynmodel.Enable = 'On';
    else
        handles.text_zwd.Enable = 'Off';
        handles.edit_filter_zwd_sigma0.Enable = 'Off';
        handles.edit_filter_zwd_Q.Enable = 'Off';
        handles.text_zwd_m.Enable = 'Off';
        handles.popupmenu_filter_zwd_dynmodel.Enable = 'Off';
    end
    
    % Receiver Clock GPS is always enabled
    set(handles.edit_filter_rec_clock_Q,             'Enable', 'On');
    set(handles.edit_filter_rec_clock_sigma0,        'Enable', 'On');
    set(handles.text_gps_time_offset,                'Enable', 'On');
    set(handles.text_gps_time_offset_m,              'Enable', 'On');
    set(handles.popupmenu_filter_rec_clock_dynmodel, 'Enable', 'On');
    
    % Receiver Clock Glonass
    if GLO_on
        set(handles.edit_filter_glonass_offset_Q,             'Enable', 'On');
        set(handles.edit_filter_glonass_offset_sigma0,        'Enable', 'On');
        set(handles.text_glo_time_offset,                	 'Enable', 'On');
        set(handles.text_glo_time_offset_m,                  'Enable', 'On');
        set(handles.popupmenu_filter_glonass_offset_dynmodel, 'Enable', 'On');
    else
        set(handles.edit_filter_glonass_offset_Q,             'Enable', 'Off');
        set(handles.edit_filter_glonass_offset_sigma0,        'Enable', 'Off');
        set(handles.text_glo_time_offset,                    'Enable', 'Off');
        set(handles.text_glo_time_offset_m,                  'Enable', 'Off');
        set(handles.popupmenu_filter_glonass_offset_dynmodel, 'Enable', 'Off');
    end
    
    % Receiver Clock Galileo
    if GAL_on
        set(handles.edit_filter_galileo_offset_Q,             'Enable', 'On');
        set(handles.edit_filter_galileo_offset_sigma0,        'Enable', 'On');
        set(handles.text_gal_time_offset,                	 'Enable', 'On');
        set(handles.text_gal_time_offset_m,                  'Enable', 'On');
        set(handles.popupmenu_filter_galileo_offset_dynmodel, 'Enable', 'On');
    else
        set(handles.edit_filter_galileo_offset_Q,             'Enable', 'Off');
        set(handles.edit_filter_galileo_offset_sigma0,        'Enable', 'Off');
        set(handles.text_gal_time_offset,                    'Enable', 'Off');
        set(handles.text_gal_time_offset_m,                  'Enable', 'Off');
        set(handles.popupmenu_filter_galileo_offset_dynmodel, 'Enable', 'Off');
    end
    
    % Receiver Clock BeiDou
    if BDS_on
        set(handles.edit_filter_beidou_offset_Q,             'Enable', 'On');
        set(handles.edit_filter_beidou_offset_sigma0,        'Enable', 'On');
        set(handles.text_bds_time_offset,                	 'Enable', 'On');
        set(handles.text_bds_time_offset_m,                  'Enable', 'On');
        set(handles.popupmenu_filter_beidou_offset_dynmodel, 'Enable', 'On');
    else
        set(handles.edit_filter_beidou_offset_Q,             'Enable', 'Off');
        set(handles.edit_filter_beidou_offset_sigma0,        'Enable', 'Off');
        set(handles.text_bds_time_offset,                    'Enable', 'Off');
        set(handles.text_bds_time_offset_m,                  'Enable', 'Off');
        set(handles.popupmenu_filter_beidou_offset_dynmodel, 'Enable', 'Off');
    end

    % Receiver Clock QZSS
    if handles.checkbox_QZSS.Value
        set(handles.edit_filter_qzss_offset_Q,             'Enable', 'On');
        set(handles.edit_filter_qzss_offset_sigma0,        'Enable', 'On');
        set(handles.text_qzss_time_offset,                	 'Enable', 'On');
        set(handles.text_qzss_time_offset_m,                  'Enable', 'On');
        set(handles.popupmenu_filter_qzss_offset_dynmodel, 'Enable', 'On');
    else
        set(handles.edit_filter_qzss_offset_Q,             'Enable', 'Off');
        set(handles.edit_filter_qzss_offset_sigma0,        'Enable', 'Off');
        set(handles.text_qzss_time_offset,                    'Enable', 'Off');
        set(handles.text_qzss_time_offset_m,                  'Enable', 'Off');
        set(handles.popupmenu_filter_qzss_offset_dynmodel, 'Enable', 'Off');
    end
    
    % handle receiver DCBs / receiver biases
    if bool_DCM
        % Decoupled clock Model
        handles.text_rec_dcbs.String = 'Receiver Biases:';
    else
        % Receiver clocks are not decoupled
        handles.text_rec_dcbs.String = 'Receiver DCBs:';
    end
    
    % check if initial std and system of Receiver Biases/DCBs should be enabled
    handles.checkbox_estimate_rec_dcbs.Enable = 'On';
    onoff = 'Off';
    if bool_DCM || strcmp(iono_model, 'Estimate') || ...
            strcmp(iono_model, 'Estimate with ... as constraint') || ...
            strcmp(iono_model, 'Correct with ...')
        onoff = 'On';
    end
    set(handles.text_rec_dcbs, 'Enable', onoff);
    set(handles.edit_filter_dcbs_sigma0, 'Enable', onoff);
    set(handles.edit_filter_dcbs_Q, 'Enable', onoff);
    set(handles.text_dcbs_m, 'Enable', onoff);
    set(handles.popupmenu_filter_dcbs_dynmodel, 'Enable', onoff);
    
    % checkbox: estimate receiver DCBs
    if ~handles.checkbox_estimate_rec_dcbs.Value
        handles.text_rec_dcbs.Enable = 'Off';
        handles.edit_filter_dcbs_sigma0.Enable = 'Off';
        handles.edit_filter_dcbs_Q.Enable = 'Off';
        set(handles.text_dcbs_m, 'Enable', 'Off');
        set(handles.popupmenu_filter_dcbs_dynmodel, 'Enable', 'Off');
    end
    
    % receiver clock drift
    if contains(proc_meth, '+ Doppler')
        set(handles.text_rec_clk_drift, 	           'Enable', 'On');
        set(handles.edit_filter_rec_clk_drift_sigma0,  'Enable', 'On');
        set(handles.edit_filter_rec_clk_drift_Q, 	   'Enable', 'On');
        set(handles.text_rec_clk_drift_m, 	           'Enable', 'On');
        set(handles.popupmenu_filter_rec_clk_drift_dynmodel, 'Enable', 'On');
    else
        set(handles.text_rec_clk_drift, 	           'Enable', 'Off');
        set(handles.edit_filter_rec_clk_drift_sigma0,  'Enable', 'Off');
        set(handles.edit_filter_rec_clk_drift_Q, 	   'Enable', 'Off');
        set(handles.text_rec_clk_drift_m, 	           'Enable', 'Off');
        set(handles.popupmenu_filter_rec_clk_drift_dynmodel, 'Enable', 'Off');
    end

    % Float ambiguities
    if contains(proc_meth, '+ Phase')
        set(handles.text_float_ambiguities, 	           'Enable', 'On');
        set(handles.edit_filter_ambiguities_sigma0,        'Enable', 'On');
        set(handles.edit_filter_ambiguities_Q, 	           'Enable', 'On');
        set(handles.text_float_ambiguities_m, 	           'Enable', 'On');
        set(handles.popupmenu_filter_ambiguities_dynmodel, 'Enable', 'On');
        % set(handles.buttongroup_models_biases_phase,       'Visible', 'On');
        set(handles.text81, 'Enable', 'On');
        set(handles.edit_Std_Phase, 'Enable', 'On');
    else
        set(handles.text_float_ambiguities, 	           'Enable', 'Off');
        set(handles.edit_filter_ambiguities_sigma0,        'Enable', 'Off');
        set(handles.edit_filter_ambiguities_Q, 	           'Enable', 'Off');
        set(handles.text_float_ambiguities_m, 	           'Enable', 'Off');
        set(handles.popupmenu_filter_ambiguities_dynmodel, 'Enable', 'Off');
        % set(handles.buttongroup_models_biases_phase,       'Visible', 'Off');
        set(handles.text81, 'Enable', 'Off');
        set(handles.edit_Std_Phase, 'Enable', 'Off');
    end
    
    % Check ionosphere model
    if strcmp(iono_model, 'Estimate with ... as constraint') || ...
            strcmp(iono_model, 'Estimate') || ...
            bool_DCM
        % filter settings
        set(handles.edit_filter_iono_Q,             'Enable', 'On');
        set(handles.edit_filter_iono_sigma0,        'Enable', 'On');
        set(handles.popupmenu_filter_iono_dynmodel, 'Enable', 'On');
        set(handles.text_iono,                      'Enable', 'On');
        set(handles.text_iono_m,                    'Enable', 'On');
    else
        % filter settings
        set(handles.edit_filter_iono_Q,             'Enable', 'Off');
        set(handles.edit_filter_iono_sigma0,        'Enable', 'Off');
        set(handles.popupmenu_filter_iono_dynmodel, 'Enable', 'Off');
        set(handles.text_iono,                      'Enable', 'Off');
        set(handles.text_iono_m,                    'Enable', 'Off');
    end

end



%% Observation Weighting
if strcmpi(handles.uipanel_weighting.Visible, 'on')
    
    % Check handling of ionospheric delay
    set(handles.text_std_iono,                  'Enable', 'Off');
    set(handles.edit_Std_Iono,                  'Enable', 'Off');
    set(handles.buttongroup_source_ionosphere,  'Visible','Off');
    set(handles.text_constraint_until,          'Visible','Off');
    set(handles.edit_constraint_until,          'Visible','Off');
    set(handles.text_constraint_decrease,       'Visible','Off');
    set(handles.edit_constraint_decrease,       'Visible','Off');
    if strcmp(iono_model, 'Estimate with ... as constraint')
        % Ionospheric constraint
        set(handles.text_std_iono,                  'Enable', 'On');
        set(handles.edit_Std_Iono,                  'Enable', 'On');
        set(handles.buttongroup_source_ionosphere,  'Visible','On');
        set(handles.text_constraint_until,          'Visible','On');
        set(handles.edit_constraint_until,          'Visible','On');
        set(handles.text_constraint_decrease,       'Visible','On');
        set(handles.edit_constraint_decrease,       'Visible','On');
    end

    % Check if code observations are used
    set(handles.text76,                         'Enable', 'Off');
    set(handles.edit_Std_CA_Code,               'Enable', 'Off');
    if contains(proc_meth, 'Code')
        % phase observations are processed
        set(handles.text76,                     'Enable', 'On');
        set(handles.edit_Std_CA_Code,           'Enable', 'On');
    end

    % Check if phase observations are used
    set(handles.text81,                         'Enable', 'Off');
    set(handles.edit_Std_Phase,                 'Enable', 'Off');
    if contains(proc_meth, '+ Phase')
        % phase observations are processed
        set(handles.text81,                     'Enable', 'On');
        set(handles.edit_Std_Phase,             'Enable', 'On');
    end

    % Check if Doppler observations are used
    set(handles.text_std_doppler,               'Enable', 'Off');
    set(handles.edit_Std_Doppler,               'Enable', 'Off');
    if contains(proc_meth, '+ Doppler')
        % Doppler observations are processed
        set(handles.text_std_doppler,           'Enable', 'On');
        set(handles.edit_Std_Doppler,           'Enable', 'On');
    end
    
    % GNSS weighting
    handles.edit_weight_GPS.Enable = 'Off'; handles.text_weight_GPS.Enable = 'Off';
    handles.edit_weight_GLO.Enable = 'Off'; handles.text_weight_GLO.Enable = 'Off';
    handles.edit_weight_GAL.Enable = 'Off'; handles.text_weight_GAL.Enable = 'Off';
    handles.edit_weight_BDS.Enable = 'Off'; handles.text_weight_BDS.Enable = 'Off';
    handles.edit_weight_QZSS.Enable = 'Off';handles.text_weight_QZSS.Enable = 'Off';
    if batch_proc
        handles.edit_weight_GPS.Enable = 'On'; handles.text_weight_GPS.Enable = 'On';
        handles.edit_weight_GLO.Enable = 'On'; handles.text_weight_GLO.Enable = 'On';
        handles.edit_weight_GAL.Enable = 'On'; handles.text_weight_GAL.Enable = 'On';
        handles.edit_weight_BDS.Enable = 'On'; handles.text_weight_BDS.Enable = 'On';
        handles.edit_weight_QZSS.Enable = 'On';handles.text_weight_QZSS.Enable = 'On';
    else
        if GPS_on
            handles.edit_weight_GPS.Enable = 'On'; handles.text_weight_GPS.Enable = 'On';
        end
        if GLO_on
            handles.edit_weight_GLO.Enable = 'On'; handles.text_weight_GLO.Enable = 'On';
        end
        if GAL_on
            handles.edit_weight_GAL.Enable = 'On'; handles.text_weight_GAL.Enable = 'On';
        end
        if BDS_on
            handles.edit_weight_BDS.Enable = 'On'; handles.text_weight_BDS.Enable = 'On';
        end
        if handles.checkbox_QZSS.Value
            handles.edit_weight_QZSS.Enable = 'On';handles.text_weight_QZSS.Enable = 'On';
        end		
    end
    
    % Frequency-specific standard observations for code and phase
    handles.uitable_code_std_frqs.Enable =  'Off';
    handles.uitable_phase_std_frqs.Enable =  'Off';
    handles.text_table_code_frq_std.Enable = 'Off';
    handles.text_table_phase_frq_std.Enable = 'Off';
    if handles.checkbox_std_frqs.Value
        handles.uitable_code_std_frqs.Enable =  'On';
        handles.uitable_phase_std_frqs.Enable =  'On';
        handles.text_table_code_frq_std.Enable = 'On';
        handles.text_table_phase_frq_std.Enable = 'On';
    end
    
end



%% Processing Options
if strcmpi(handles.uipanel_processingOptions.Visible, 'on')
    
    % ||| implement at some point
    
    
    % Processing method:
    value = get(handles.popupmenu_process, 'Value');
    string_all = get(handles.popupmenu_process,'String');
    proc_meth = lower(string_all{value});       % to be on the safe side
    % activate float ambiguity fields only if code+phase is processed
    if strcmpi(proc_meth,'code only') || strcmpi(proc_meth,'code (doppler smoothing)') ...
            || strcmpi(proc_meth,'code + doppler') || strcmpi(proc_meth,'code (phase smoothing)')
        set(handles.text_float_ambiguities, 	           'Enable', 'Off');
        set(handles.edit_filter_ambiguities_sigma0,        'Enable', 'Off');
        set(handles.edit_filter_ambiguities_Q, 	           'Enable', 'Off');
        set(handles.text_float_ambiguities_m, 	           'Enable', 'Off');
        set(handles.popupmenu_filter_ambiguities_dynmodel, 'Enable', 'Off');
        % set(handles.buttongroup_models_biases_phase,       'Visible', 'Off');
        set(handles.checkbox_AdjustPhase,                     'Visible', 'Off');
    elseif strcmpi(proc_meth,'code + phase')
        set(handles.text_float_ambiguities, 	           'Enable', 'On');
        set(handles.edit_filter_ambiguities_sigma0,        'Enable', 'On');
        set(handles.edit_filter_ambiguities_Q, 	           'Enable', 'On');
        set(handles.text_float_ambiguities_m, 	           'Enable', 'On');
        set(handles.popupmenu_filter_ambiguities_dynmodel, 'Enable', 'On');
        % set(handles.buttongroup_models_biases_phase,       'Visible', 'On');
        set(handles.checkbox_AdjustPhase,                     'Visible', 'On');
    end
    % activate smoothing window if needed
    if contains(proc_meth, 'smoothing')
        set(handles.text_smooth,       'Visible', 'On');
        set(handles.edit_smooth,       'Visible', 'On');
    else
        set(handles.text_smooth,       'Visible', 'Off');
        set(handles.edit_smooth,       'Visible', 'Off');
    end

    
    if handles.checkbox_fixing.Value
        handles.checkbox_reset_fixed.Enable = 'On';
    else
        handles.checkbox_reset_fixed.Enable = 'Off';
    end
    onoff = 'Off';
    if handles.checkbox_reset_float.Value || handles.checkbox_reset_fixed.Value
        onoff = 'On';
    end
    handles.radiobutton_reset_epoch.Enable = onoff;
    handles.radiobutton_reset_min.Enable = onoff;
    handles.text_reset_epoch.Enable = onoff;
    handles.edit_reset_epoch.Enable = onoff;
    

    % disable buttongroup time span if ... is enabled
    % ... batch processing
    % ... real-time processing
    onoff = 'On';     
    if batch_proc || handles.checkbox_realtime.Value; onoff = 'Off';  end
    set(handles.edit_timeFrame_from, 'Enable', onoff);
    set(handles.edit_timeFrame_to, 'Enable', onoff);
    set(handles.text62, 'Enable', onoff);
    set(handles.radiobutton_timeSpan_format_epochs, 'Enable', onoff);
    set(handles.radiobutton_timeSpan_format_time, 'Enable', onoff);
    set(handles.radiobutton_timeSpan_format_SOD, 'Enable', onoff);
    set(handles.radiobutton_timeSpan_format_HOD, 'Enable', onoff);
    
    % check omc
    onoff = 'Off';     if handles.checkbox_check_omc.Value; onoff = 'On'; end
    set(handles.text_omc_thresh_c, 'Enable', onoff);
    set(handles.text_omc_thresh_p, 'Enable', onoff);
    set(handles.text_omc_fac, 'Enable', onoff);
    set(handles.text_omc_window, 'Enable', onoff);
    set(handles.edit_omc_thresh_c, 'Enable', onoff);
    set(handles.edit_omc_thresh_p, 'Enable', onoff);
    set(handles.edit_omc_fac, 'Enable', onoff);
    set(handles.edit_omc_window, 'Enable', onoff);
    if ~contains(proc_meth, '+ phase')
        set(handles.text_omc_thresh_p, 'Enable', 'Off');
        set(handles.edit_omc_thresh_p, 'Enable', 'Off');
    end
    
end


%% Export Options
if strcmpi(handles.uipanel_export.Visible, 'on')

    % storeData
    handles.checkbox_exp_storeData.Enable    = 'on';
    handles.checkbox_exp_storeData_vtec.Enable    = 'on';
    handles.checkbox_exp_storeData_iono_mf.Enable = 'on';
    handles.checkbox_exp_storeData_mp_1_2.Enable  = 'on';
    handles.checkbox_exp_storeData_sat_status.Enable    = 'on';
    % obs
    handles.checkbox_exp_obs_bias.Enable    = 'on';
    handles.checkbox_exp_obs_epochheader.Enable    = 'on';
    % satellites
    handles.checkbox_exp_satellites.Enable    = 'on';
    handles.checkbox_exp_satellites_D.Enable    = 'on';


    % Variables - storeData
    if handles.checkbox_exp_storeData.Value
        handles.checkbox_exp_storeData_vtec.Enable    = 'on';
        handles.checkbox_exp_storeData_iono_mf.Enable = 'on';
        handles.checkbox_exp_storeData_mp_1_2.Enable  = 'on';
        if strcmp(iono_model, 'Estimate with ... as constraint') ...
                || strcmp(iono_model, 'Correct with ...')
            handles.checkbox_exp_storeData_vtec.Enable = 'on';
            handles.checkbox_exp_storeData_iono_mf.Enable = 'on';
        else
            handles.checkbox_exp_storeData_vtec.Enable = 'off';
            handles.checkbox_exp_storeData_iono_mf.Enable = 'off';
        end
    else
        handles.checkbox_exp_storeData_vtec.Enable    = 'off';
        handles.checkbox_exp_storeData_iono_mf.Enable = 'off';
        handles.checkbox_exp_storeData_mp_1_2.Enable  = 'off';
    end 

    
    if ~handles.checkbox_exp_data4plot.Value
        % storeData
        handles.checkbox_exp_storeData.Enable    = 'off';
        handles.checkbox_exp_storeData_vtec.Enable    = 'off';
        handles.checkbox_exp_storeData_iono_mf.Enable = 'off';
        handles.checkbox_exp_storeData_mp_1_2.Enable  = 'off';
        handles.checkbox_exp_storeData_sat_status.Enable    = 'off';
        % obs
        handles.checkbox_exp_obs_bias.Enable    = 'off';
        handles.checkbox_exp_obs_epochheader.Enable    = 'off';
        % satellites
        handles.checkbox_exp_satellites.Enable    = 'off';
        handles.checkbox_exp_satellites_D.Enable    = 'off';
    end

    
    
    % ||| implement at some point
    
end


%% Single-Plot
if strcmpi(handles.uipanel_single_plot.Visible, 'on')
    
    % ||| implement at some point
    
    
    % check if use of Multi-Plot-Table is enabled
    if handles.checkbox_singlemultiplot.Value
        onoff = 'Off';      % Multi-Plot table is used
        handles.checkbox_plot_gps.Enable = 'On';    % enable all GNSS
        handles.checkbox_plot_glo.Enable = 'On';
        handles.checkbox_plot_gal.Enable = 'On';
        handles.checkbox_plot_bds.Enable = 'On';
		handles.checkbox_plot_qzss.Enable = 'On';
        handles = en_disable_AllPlotCheckboxes(handles, 'On');
    else
        onoff = 'On';
        % load settings for en/disabling checkboxes of plots which are (not) possible
        if ~isempty(handles.paths.plotfile) && isfolder(handles.paths.plotfile)
            if isfile([handles.paths.plotfile '/settings.mat'])
                load([handles.paths.plotfile '/settings.mat'], 'settings');
            elseif isfile([handles.paths.plotfile '/data4plot.mat'])
                load([handles.paths.plotfile '/data4plot.mat'], 'settings');
            else
                settings = recover_settings(handles.paths.plotfile);
            end
            handles = disable_plot_checkboxes(handles, settings);
        else
            % plot folder does not exist (anymore), reset single plot panel
            handles = en_disable_AllPlotCheckboxes(handles, 'off');
            handles.paths.plotfile = '';
            set(handles.edit_x_true,  'String', '');
            set(handles.edit_y_true,  'String', '');
            set(handles.edit_z_true,  'String', '');
            set(handles.edit_plot_path,'String', '');
        end
    end
    % en/disable content which is disabled for using Multi-Plot table
    handles.text_plot_path.Enable = onoff;
    handles.edit_plot_path.Enable = onoff;
    handles.pushbutton_plot_path.Enable = onoff;
    handles.text_pos_true.Enable = onoff;
    handles.pushbutton_load_pos_true.Enable = onoff;
	handles.pushbutton_load_true_kinematic.Enable = onoff;
    handles.text_x_true.Enable = onoff;
    handles.text_y_true.Enable = onoff;
    handles.text_z_true.Enable = onoff;
    handles.edit_x_true.Enable = onoff;
    handles.edit_y_true.Enable = onoff;
    handles.edit_z_true.Enable = onoff;
    handles.text139.Enable = onoff;
    handles.text141.Enable = onoff;
    handles.text143.Enable = onoff;
    
end



%% Batch-Processing
if strcmpi(handles.uipanel_batch_proc.Visible, 'on')
    % ||| implement at some point
    
    % enable stuff on this panel if batch processing is enabled
    onoff = 'Off';
    if batch_proc
        onoff = 'On';
    end
    set(handles.uitable_batch_proc, 'Enable', onoff);
    set(handles.pushbutton_add_files, 'Enable', onoff);
    set(handles.pushbutton_add_folder, 'Enable', onoff);
    set(handles.pushbutton_delete_all_file, 'Enable', onoff);
    set(handles.checkbox_parfor, 'Enable', onoff);
    set(handles.checkbox_batch_manipulate_identical, 'Enable', onoff);
    set(handles.checkbox_manipulate_all, 'Enable', onoff);
	set(handles.pushbutton_plot_stations, 'Enable', onoff);
    set(handles.load_process_list, 'Enable', onoff);
    set(handles.save_process_list, 'Enable', onoff);
    
end


%% Multi-Plot
if strcmpi(handles.uipanel_multi_plot.Visible, 'on')
    
    % ||| implement at some point
       
    % not totally clean, only one manipulate checkbox is allowed to be enabled
    if 1 < sum(handles.checkbox_multi_manipulate_identical.Value + ...
            handles.checkbox_multi_manipulate_same_label.Value + ...
            handles.checkbox_multi_manipulate_same_station.Value)
        handles.checkbox_multi_manipulate_identical.Value = false;
        handles.checkbox_multi_manipulate_same_label.Value = false;
        handles.checkbox_multi_manipulate_same_station.Value = false;
    end
    
    % En/Disable TTFF Plot
    if handles.radiobutton_multi_plot_float.Value    	% float solution
        handles.checkbox_ttff_plot.Enable = 'Off';
    else                                               	% fixed solution
        handles.checkbox_ttff_plot.Enable = 'On';
    end
    
    
    % En/Disable definition of points in time
    handles.edit_conv_min.Enable = 'off';
    handles.text_conv_min.Enable = 'off';
    if handles.checkbox_histo_conv.Value || handles.checkbox_bar_conv.Value || handles.checkbox_convaccur.Value
        handles.edit_conv_min.Enable = 'on';
        handles.text_conv_min.Enable = 'on';
    end


end







