% dlg_parser - pops dialogue, called by pop_parseeyelink() and % pop_parseIViewx() % see >> help pop_parsesmi % or >> help pop_parseeyelink % % Copyright (C) 2009-2017 Olaf Dimigen & Ulrich Reinacher, HU Berlin % olaf.dimigen@hu-berlin.de % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 3 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; if not, write to the Free Software % Foundation, 51 Franklin Street, Boston, MA 02110-1301, USA function [fileToLoad, matToSave, useKeyword, triggerKeyword] = dlg_parser(callingFcn) % callbacks cb_selectSource = ['[filename filepath] = uigetfile2(''*'', ''Select text file - ',callingFcn,'()'');'... 'if filename(1) ~=0,' ... ' set(findobj(''parent'', gcbf, ''tag'', tagToUpdate), ''string'', [ filepath filename ]);' ... 'end;' ... 'clear filename filepath tagToUpdate' ... ]; cb_selectTargetMat = ['[filename filepath] = uiputfile2(''*.mat'', ''Save data in MATLAB format - ',callingFcn,'()'');'... 'if filename(1) ~=0,' ... ' set(findobj(''parent'', gcbf, ''tag'', tagToUpdate), ''string'', [ filepath filename ]);' ... 'end;' ... 'clear filename filepath tagToUpdate' ... ]; cb_useKeyword = ['if get(gcbo,''value''),'... 'newStatus = ''on'';'... 'else ,'... 'newStatus = ''off'';'... 'end ,'... 'set(findobj(''parent'', gcbf,''tag'',''triggerKeyword''),''enable'',newStatus);'... 'clear newStatus;'... ]; clear filename filepath tagToUpdate geometry = {1 [3.5 2.5 1] [3.5 2.5 1] 1 1 [3.5 2.5 1] [3.5 2.5 1]}; uilist = { ... { 'Style', 'text', 'string', 'Parse eye tracking data and convert it to MATLAB format', 'horizontalalignment', 'right', 'fontweight', 'bold'},... ... { 'Style', 'text', 'string', 'Load raw eye tracking data (text file):', 'horizontalalignment', 'right'},... { 'Style', 'edit', 'string', '', 'horizontalalignment', 'left', 'tag', 'fileToLoad' },... { 'Style', 'pushbutton', 'string', 'Browse...', 'callback', ['tagToUpdate = ''fileToLoad'';' cb_selectSource] },... ... { 'Style', 'text', 'string', 'Save MATLAB copy (.mat) here:', 'horizontalalignment', 'right'},... { 'Style', 'edit', 'string', '', 'horizontalalignment', 'left', 'tag', 'matToSave' },... { 'Style', 'pushbutton', 'string', 'Browse...', 'callback', ['tagToUpdate = ''matToSave'';' cb_selectTargetMat] },... ... { },... { 'Style', 'text', 'string', 'Optional: Fill in only if messages were used as synchronization events', 'horizontalalignment', 'right','fontweight','bold' },... ... { 'Style', 'text', 'string', 'Special messages (keyword+number) were sent:'},... { 'Style', 'checkbox', 'tag','useKeyword','callback',cb_useKeyword },... % 'fontweight', 'bold', { 'Style', 'text', 'string', ''},... ... { 'Style', 'text', 'string', 'Keyword used (e.g. "MYKEYWORD"):', 'horizontalalignment', 'right'},... { 'Style', 'edit', 'string', 'type keyword here', 'horizontalalignment', 'center', 'tag', 'triggerKeyword','enable','off'},... { 'Style', 'text', 'string', ''} }; [results userdat str outstruct] = inputgui( geometry, uilist, ['pophelp(''',callingFcn,''');'], ['Parse and save eye tracking data -- ',callingFcn,'()']); if isempty(results) % user cancel return end % transform needed, cannot use structure assignment in function % input or output definitions fileToLoad = outstruct.fileToLoad; matToSave = outstruct.matToSave; useKeyword = outstruct.useKeyword; triggerKeyword = outstruct.triggerKeyword; end