diff aim-mat/gui/sr_questionbox.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/aim-mat/gui/sr_questionbox.m	Tue Aug 16 14:37:17 2011 +0100
@@ -0,0 +1,145 @@
+% 
+% (c) 2011, University of Southampton
+% Maintained by Stefan Bleeck (bleeck@gmail.com)
+% download of current version is on the soundsoftware site: 
+% http://code.soundsoftware.ac.uk/projects/aimmat
+% documentation and everything is on http://www.acousticscale.org
+
+function varargout = sr_questionbox(varargin)
+% SR_QUESTIONBOX M-file for sr_questionbox.fig
+%      SR_QUESTIONBOX, by itself, creates a new SR_QUESTIONBOX or raises the existing
+%      singleton*.
+%
+%      H = SR_QUESTIONBOX returns the handle to a new SR_QUESTIONBOX or the handle to
+%      the existing singleton*.
+%
+%      SR_QUESTIONBOX('CALLBACK',hObject,eventData,handles,...) calls the local
+%      function named CALLBACK in SR_QUESTIONBOX.M with the given input arguments.
+%
+%      SR_QUESTIONBOX('Property','Value',...) creates a new SR_QUESTIONBOX or raises the
+%      existing singleton*.  Starting from the left, property value pairs are
+%      applied to the GUI before sr_questionbox_OpeningFunction gets called.  An
+%      unrecognized property name or invalid value makes property application
+%      stop.  All inputs are passed to sr_questionbox_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 sr_questionbox
+
+% Last Modified by GUIDE v2.5 14-Mar-2003 17:30:37
+
+% Begin initialization code - DO NOT EDIT
+gui_Singleton = 1;
+gui_State = struct('gui_Name',       mfilename, ...
+                   'gui_Singleton',  gui_Singleton, ...
+                   'gui_OpeningFcn', @sr_questionbox_OpeningFcn, ...
+                   'gui_OutputFcn',  @sr_questionbox_OutputFcn, ...
+                   'gui_LayoutFcn',  [] , ...
+                   'gui_Callback',   []);
+if nargin & isstr(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 sr_questionbox is made visible.
+function sr_questionbox_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 sr_questionbox (see VARARGIN)
+
+% Choose default command line output for sr_questionbox
+handles.output = hObject;
+
+old_sr=varargin{1};
+handles.old_sr=old_sr;
+handles.output=old_sr;
+
+set(handles.edit1,'String',old_sr);
+
+
+% Update handles structure
+guidata(hObject, handles);
+
+% do modal
+% UIWAIT makes sr_questionbox wait for user response (see UIRESUME)
+uiwait(handles.figure1);
+
+
+% --- Outputs from this function are returned to the command line.
+function varargout = sr_questionbox_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
+varargout{1} = handles.output;
+close(handles.figure1);
+
+
+% --- Executes during object creation, after setting all properties.
+function edit1_CreateFcn(hObject, eventdata, handles)
+% hObject    handle to edit1 (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
+    set(hObject,'BackgroundColor','white');
+else
+    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
+end
+
+
+
+function edit1_Callback(hObject, eventdata, handles)
+% hObject    handle to edit1 (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 edit1 as text
+%        str2double(get(hObject,'String')) returns contents of edit1 as a double
+
+num=str2num(get(handles.edit1,'String'));
+if isempty(num)
+	num=handles.old_sr;
+end
+if num<1
+	num=handles.old_sr;
+end
+set(handles.edit1,'String',num2str(num));
+
+handles.output=num;
+guidata(hObject, handles);
+
+% --- Executes on button press in pushbutton1.
+function pushbutton1_Callback(hObject, eventdata, handles)
+% hObject    handle to pushbutton1 (see GCBO)
+% eventdata  reserved - to be defined in a future version of MATLAB
+% handles    structure with handles and user data (see GUIDATA)
+handles.output=str2num(get(handles.edit1,'String'));
+guidata(hObject, handles);
+uiresume;
+
+% --- Executes on button press in pushbutton2.
+function pushbutton2_Callback(hObject, eventdata, handles)
+% hObject    handle to pushbutton2 (see GCBO)
+% eventdata  reserved - to be defined in a future version of MATLAB
+% handles    structure with handles and user data (see GUIDATA)
+handles.output=handles.old_sr;
+guidata(hObject, handles);
+uiresume;
+