function varargout = test_schicht(varargin)
% TEST_SCHICHT M-file for test_schicht.fig
%      TEST_SCHICHT, by itself, creates a new TEST_SCHICHT or raises the existing
%      singleton*.
%
%      H = TEST_SCHICHT returns the handle to a new TEST_SCHICHT or the handle to
%      the existing singleton*.
%
%      TEST_SCHICHT('CALLBACK',hObject,~,handles,...) calls the local
%      function named CALLBACK in TEST_SCHICHT.M with the given input arguments.
%
%      TEST_SCHICHT('Property','Value',...) creates a new TEST_SCHICHT or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before test_schicht_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to test_schicht_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help test_schicht

% Last Modified by GUIDE v2.5 17-Nov-2011 12:11:59

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @test_schicht_OpeningFcn, ...
                   'gui_OutputFcn',  @test_schicht_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before test_schicht is made visible.
function test_schicht_OpeningFcn(hObject, ~, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% ~  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to test_schicht (see VARARGIN)

% Choose default command line output for test_schicht
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes test_schicht wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = test_schicht_OutputFcn(hObject, ~, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% ~  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

function edit7_Callback(hObject, ~, handles) % Schichtanzahl
if str2double(get(hObject,'String')) > 1
    set(handles.slider1,'Visible','on');
end
set(handles.slider1,'Max',str2double(get(hObject,'String'))-1);
set(handles.slider1,'Value',str2double(get(hObject,'String'))-1);

% --- Executes on slider movement.
function slider1_Callback(hObject, ~, handles)
switch get(hObject,'Value')
    case get(hObject,'Max')
        set(handles.uipanel1,'Visible','on');
        set(handles.uipanel2,'Visible','off');
        set(handles.uipanel3,'Visible','off');
    case get(hObject,'Max') - 1
        set(handles.uipanel1,'Visible','off');
        set(handles.uipanel2,'Visible','on');
        set(handles.uipanel3,'Visible','off');
    case get(hObject,'Max') - 2
        set(handles.uipanel1,'Visible','off');
        set(handles.uipanel2,'Visible','off');
        set(handles.uipanel3,'Visible','on');
end


function edit1_Callback(hObject, ~, handles)
    index = 1;
    handles.par(index) = str2double(get(hObject,'String'));
    set_back_schicht(handles.par(index), handles.text_hoehe(index), hObject);
    pos_check_schicht(handles.par(index), handles.text_hoehe(index), hObject); 

function edit2_Callback(hObject, ~, handles)
% hObject    handle to edit2 (see GCBO)
% ~  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double
function edit3_Callback(hObject, ~, handles)
index = 2;
handles.par(index) = str2double(get(hObject,'String'));
set_back_schicht(handles.par(index), handles.text_hoehe(index), hObject);
pos_check_schicht(handles.par(index), handles.text_hoehe(index), hObject); 


function edit4_Callback(hObject, ~, handles)
% hObject    handle to edit4 (see GCBO)
% ~  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit4 as text
%        str2double(get(hObject,'String')) returns contents of edit4 as a double


function edit5_Callback(hObject, ~, handles)
index = 3;
handles.par(index) = str2double(get(hObject,'String'));
set_back_schicht(handles.par(index), handles.text_hoehe(index), hObject);
pos_check_schicht(handles.par(index), handles.text_hoehe(index), hObject); 


function edit6_Callback(hObject, ~, handles)

% Hints: get(hObject,'String') returns contents of edit6 as text
%        str2double(get(hObject,'String')) returns contents of edit6 as a double


%%% CREATE FUNCTIONS %%%
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, ~, handles)
% hObject    handle to slider1 (see GCBO)
% ~  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end





% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, ~, handles)
% hObject    handle to edit1 (see GCBO)
% ~  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, ~, handles)
% hObject    handle to edit2 (see GCBO)
% ~  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end





% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, ~, handles)
% hObject    handle to edit3 (see GCBO)
% ~  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, ~, handles)
% hObject    handle to edit4 (see GCBO)
% ~  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, ~, handles)
% hObject    handle to edit7 (see GCBO)
% ~  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, ~, handles)
% hObject    handle to edit5 (see GCBO)
% ~  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, ~, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
