%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Codigo comum a todos os elementos do GUI
function varargout = slider1(varargin)
  gui_Singleton = 1;
  gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @slider1_OpeningFcn, ...
                   'gui_OutputFcn',  @slider1_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   
function slider1_OpeningFcn(hObject, eventdata, handles, varargin)
  handles.output = hObject;
  guidata(hObject, handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TORNOZELO - KI
    function slider1_editText_TorDirki_Callback(hObject, eventdata, handles)
      sliderValue = get(handles.slider1_editText_TorDirki,'String');
      sliderValue = str2num(sliderValue);
      if (isempty(sliderValue) || sliderValue < 0 || sliderValue > 10000)
        set(handles.slider1_TorDirki,'Value',0);
        set(handles.slider1_editText_TorDirki,'String','0');
      else
        set(handles.slider1_TorDirki,'Value',sliderValue);
      end
      guidata(hObject, handles);
    
    function slider1_editText_TorDirki_CreateFcn(hObject, eventdata, handles)
      if ispc
        set(hObject,'BackgroundColor','white');
      else
        set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
      end
    
    function slider1_TorDirki_Callback(hObject, eventdata, handles)
      sliderValue = get(handles.slider1_TorDirki,'Value');
      set(handles.slider1_editText_TorDirki,'String', num2str(sliderValue));
      guidata(hObject, handles);
    
    function slider1_TorDirki_CreateFcn(hObject, eventdata, handles)
      usewhitebg = 1;
      if usewhitebg
        set(hObject,'BackgroundColor',[.9 .9 .9]);
      else
        set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
      end 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TORNOZELO - KF
    function slider1_editText_TorDirkf_Callback(hObject, eventdata, handles)
      sliderValue = get(handles.slider1_editText_TorDirkf,'String');
      sliderValue = str2num(sliderValue);
      if (isempty(sliderValue) || sliderValue < 0 || sliderValue > 10000)
        set(handles.slider1_TorDirkf,'Value',0);
        set(handles.slider1_editText_TorDirkf,'String','0');
      else
        set(handles.slider1_TorDirkf,'Value',sliderValue);
      end
      guidata(hObject, handles);

    function slider1_editText_TorDirkf_CreateFcn(hObject, eventdata, handles)
      if ispc
        set(hObject,'BackgroundColor','white');
      else
        set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
      end

    function slider1_TorDirkf_Callback(hObject, eventdata, handles)
      sliderValue = get(handles.slider1_TorDirkf,'Value');
      set(handles.slider1_editText_TorDirkf,'String', num2str(sliderValue));
      guidata(hObject, handles);

    function slider1_TorDirkf_CreateFcn(hObject, eventdata, handles)
      usewhitebg = 1;
      if usewhitebg
        set(hObject,'BackgroundColor',[.9 .9 .9]);
      else
        set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
      end 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TORNOZELO - EK
    function slider1_editText_TorDirek_Callback(hObject, eventdata, handles)
      sliderValue = get(handles.slider1_editText_TorDirek,'String');
      sliderValue = str2num(sliderValue);
      if (isempty(sliderValue) || sliderValue < 0 || sliderValue > 10000)
        set(handles.slider1_TorDirek,'Value',0);
        set(handles.slider1_editText_TorDirek,'String','0');
      else
        set(handles.slider1_TorDirek,'Value',sliderValue);
      end
      guidata(hObject, handles);
      
    function slider1_editText_TorDirek_CreateFcn(hObject, eventdata, handles)
      if ispc
        set(hObject,'BackgroundColor','white');
      else
        set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
      end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FIM - CRIACAO VARIAVEL SAIDA
function varargout = slider1_OutputFcn(hObject, eventdata, handles)
    valores(1,1) = get(handles.slider1_TorDirki,'Value');
    valores(2,1) = get(handles.slider1_TorDirkf,'Value');
    
    
    varargout{1,1}=valores;



function slider1_editText_Valki_Callback(hObject, eventdata, handles)
% hObject    handle to slider1_editText_Valki (see GCBO)
% eventdata  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 slider1_editText_Valki as text
%        str2double(get(hObject,'String')) returns contents of
%        slider1_editText_Valki as a double


% --- Executes during object creation, after setting all properties.
function slider1_editText_Valki_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider1_editText_Valki (see GCBO)
% eventdata  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

