bleeck@4: % bleeck@4: % (c) 2011, University of Southampton bleeck@4: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@4: % download of current version is on the soundsoftware site: bleeck@4: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@4: % documentation and everything is on http://www.acousticscale.org bleeck@4: bleeck@4: function varargout = sr_questionbox(varargin) bleeck@4: % SR_QUESTIONBOX M-file for sr_questionbox.fig bleeck@4: % SR_QUESTIONBOX, by itself, creates a new SR_QUESTIONBOX or raises the existing bleeck@4: % singleton*. bleeck@4: % bleeck@4: % H = SR_QUESTIONBOX returns the handle to a new SR_QUESTIONBOX or the handle to bleeck@4: % the existing singleton*. bleeck@4: % bleeck@4: % SR_QUESTIONBOX('CALLBACK',hObject,eventData,handles,...) calls the local bleeck@4: % function named CALLBACK in SR_QUESTIONBOX.M with the given input arguments. bleeck@4: % bleeck@4: % SR_QUESTIONBOX('Property','Value',...) creates a new SR_QUESTIONBOX or raises the bleeck@4: % existing singleton*. Starting from the left, property value pairs are bleeck@4: % applied to the GUI before sr_questionbox_OpeningFunction gets called. An bleeck@4: % unrecognized property name or invalid value makes property application bleeck@4: % stop. All inputs are passed to sr_questionbox_OpeningFcn via varargin. bleeck@4: % bleeck@4: % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one bleeck@4: % instance to run (singleton)". bleeck@4: % bleeck@4: % See also: GUIDE, GUIDATA, GUIHANDLES bleeck@4: bleeck@4: % Edit the above text to modify the response to help sr_questionbox bleeck@4: bleeck@4: % Last Modified by GUIDE v2.5 14-Mar-2003 17:30:37 bleeck@4: bleeck@4: % Begin initialization code - DO NOT EDIT bleeck@4: gui_Singleton = 1; bleeck@4: gui_State = struct('gui_Name', mfilename, ... bleeck@4: 'gui_Singleton', gui_Singleton, ... bleeck@4: 'gui_OpeningFcn', @sr_questionbox_OpeningFcn, ... bleeck@4: 'gui_OutputFcn', @sr_questionbox_OutputFcn, ... bleeck@4: 'gui_LayoutFcn', [] , ... bleeck@4: 'gui_Callback', []); bleeck@4: if nargin & isstr(varargin{1}) bleeck@4: gui_State.gui_Callback = str2func(varargin{1}); bleeck@4: end bleeck@4: bleeck@4: if nargout bleeck@4: [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); bleeck@4: else bleeck@4: gui_mainfcn(gui_State, varargin{:}); bleeck@4: end bleeck@4: % End initialization code - DO NOT EDIT bleeck@4: bleeck@4: bleeck@4: % --- Executes just before sr_questionbox is made visible. bleeck@4: function sr_questionbox_OpeningFcn(hObject, eventdata, handles, varargin) bleeck@4: % This function has no output args, see OutputFcn. bleeck@4: % hObject handle to figure bleeck@4: % eventdata reserved - to be defined in a future version of MATLAB bleeck@4: % handles structure with handles and user data (see GUIDATA) bleeck@4: % varargin command line arguments to sr_questionbox (see VARARGIN) bleeck@4: bleeck@4: % Choose default command line output for sr_questionbox bleeck@4: handles.output = hObject; bleeck@4: bleeck@4: old_sr=varargin{1}; bleeck@4: handles.old_sr=old_sr; bleeck@4: handles.output=old_sr; bleeck@4: bleeck@4: set(handles.edit1,'String',old_sr); bleeck@4: bleeck@4: bleeck@4: % Update handles structure bleeck@4: guidata(hObject, handles); bleeck@4: bleeck@4: % do modal bleeck@4: % UIWAIT makes sr_questionbox wait for user response (see UIRESUME) bleeck@4: uiwait(handles.figure1); bleeck@4: bleeck@4: bleeck@4: % --- Outputs from this function are returned to the command line. bleeck@4: function varargout = sr_questionbox_OutputFcn(hObject, eventdata, handles) bleeck@4: % varargout cell array for returning output args (see VARARGOUT); bleeck@4: % hObject handle to figure bleeck@4: % eventdata reserved - to be defined in a future version of MATLAB bleeck@4: % handles structure with handles and user data (see GUIDATA) bleeck@4: bleeck@4: % Get default command line output from handles structure bleeck@4: varargout{1} = handles.output; bleeck@4: close(handles.figure1); bleeck@4: bleeck@4: bleeck@4: % --- Executes during object creation, after setting all properties. bleeck@4: function edit1_CreateFcn(hObject, eventdata, handles) bleeck@4: % hObject handle to edit1 (see GCBO) bleeck@4: % eventdata reserved - to be defined in a future version of MATLAB bleeck@4: % handles empty - handles not created until after all CreateFcns called bleeck@4: bleeck@4: % Hint: edit controls usually have a white background on Windows. bleeck@4: % See ISPC and COMPUTER. bleeck@4: if ispc bleeck@4: set(hObject,'BackgroundColor','white'); bleeck@4: else bleeck@4: set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); bleeck@4: end bleeck@4: bleeck@4: bleeck@4: bleeck@4: function edit1_Callback(hObject, eventdata, handles) bleeck@4: % hObject handle to edit1 (see GCBO) bleeck@4: % eventdata reserved - to be defined in a future version of MATLAB bleeck@4: % handles structure with handles and user data (see GUIDATA) bleeck@4: bleeck@4: % Hints: get(hObject,'String') returns contents of edit1 as text bleeck@4: % str2double(get(hObject,'String')) returns contents of edit1 as a double bleeck@4: bleeck@4: num=str2num(get(handles.edit1,'String')); bleeck@4: if isempty(num) bleeck@4: num=handles.old_sr; bleeck@4: end bleeck@4: if num<1 bleeck@4: num=handles.old_sr; bleeck@4: end bleeck@4: set(handles.edit1,'String',num2str(num)); bleeck@4: bleeck@4: handles.output=num; bleeck@4: guidata(hObject, handles); bleeck@4: bleeck@4: % --- Executes on button press in pushbutton1. bleeck@4: function pushbutton1_Callback(hObject, eventdata, handles) bleeck@4: % hObject handle to pushbutton1 (see GCBO) bleeck@4: % eventdata reserved - to be defined in a future version of MATLAB bleeck@4: % handles structure with handles and user data (see GUIDATA) bleeck@4: handles.output=str2num(get(handles.edit1,'String')); bleeck@4: guidata(hObject, handles); bleeck@4: uiresume; bleeck@4: bleeck@4: % --- Executes on button press in pushbutton2. bleeck@4: function pushbutton2_Callback(hObject, eventdata, handles) bleeck@4: % hObject handle to pushbutton2 (see GCBO) bleeck@4: % eventdata reserved - to be defined in a future version of MATLAB bleeck@4: % handles structure with handles and user data (see GUIDATA) bleeck@4: handles.output=handles.old_sr; bleeck@4: guidata(hObject, handles); bleeck@4: uiresume; bleeck@4: