function varargout = janis_gui_regExp(varargin)
% JANIS_GUI_REGEXP M-file for janis_gui_regExp.fig
%      JANIS_GUI_REGEXP, by itself, creates a new JANIS_GUI_REGEXP or raises the existing
%      singleton*.
%
%      H = JANIS_GUI_REGEXP returns the handle to a new JANIS_GUI_REGEXP or the handle to
%      the existing singleton*.
%
%      JANIS_GUI_REGEXP('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in JANIS_GUI_REGEXP.M with the given input arguments.
%
%      JANIS_GUI_REGEXP('Property','Value',...) creates a new JANIS_GUI_REGEXP or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before janis_gui_regExp_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to janis_gui_regExp_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 janis_gui_regExp

% Last Modified by GUIDE v2.5 14-Feb-2011 15:31:17

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @janis_gui_regExp_OpeningFcn, ...
                   'gui_OutputFcn',  @janis_gui_regExp_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 janis_gui_regExp is made visible.
function janis_gui_regExp_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to janis_gui_regExp (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);
ud.firstSub = varargin{1};
set(handles.figure1,'UserData',ud);
% UIWAIT makes janis_gui_regExp wait for user response (see UIRESUME)
uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = janis_gui_regExp_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  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
out{1} = get(handles.edit_subDir,'String'); % subDir
out{2} = get(handles.edit_regExp,'String');; % regExp
out{3} = handles;
handles.output = out;
varargout{1} = handles.output;


% --- Executes on button press in pushbutton_subDir.
function pushbutton_subDir_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton_subDir (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
ud = get(handles.figure1,'UserData');
firstSub = ud.firstSub;
subDir = uigetdir(firstSub);
if ischar(subDir)
   set(handles.edit_subDir,'String',subDir);
end



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


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



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


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


% --- Executes on button press in pushbutton_apply.
function pushbutton_apply_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton_apply (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
uiresume;
return