bleeck@4
|
1 %
|
bleeck@4
|
2 % (c) 2011, University of Southampton
|
bleeck@4
|
3 % Maintained by Stefan Bleeck (bleeck@gmail.com)
|
bleeck@4
|
4 % download of current version is on the soundsoftware site:
|
bleeck@4
|
5 % http://code.soundsoftware.ac.uk/projects/aimmat
|
bleeck@4
|
6 % documentation and everything is on http://www.acousticscale.org
|
bleeck@4
|
7
|
bleeck@4
|
8 function varargout = sr_questionbox(varargin)
|
bleeck@4
|
9 % SR_QUESTIONBOX M-file for sr_questionbox.fig
|
bleeck@4
|
10 % SR_QUESTIONBOX, by itself, creates a new SR_QUESTIONBOX or raises the existing
|
bleeck@4
|
11 % singleton*.
|
bleeck@4
|
12 %
|
bleeck@4
|
13 % H = SR_QUESTIONBOX returns the handle to a new SR_QUESTIONBOX or the handle to
|
bleeck@4
|
14 % the existing singleton*.
|
bleeck@4
|
15 %
|
bleeck@4
|
16 % SR_QUESTIONBOX('CALLBACK',hObject,eventData,handles,...) calls the local
|
bleeck@4
|
17 % function named CALLBACK in SR_QUESTIONBOX.M with the given input arguments.
|
bleeck@4
|
18 %
|
bleeck@4
|
19 % SR_QUESTIONBOX('Property','Value',...) creates a new SR_QUESTIONBOX or raises the
|
bleeck@4
|
20 % existing singleton*. Starting from the left, property value pairs are
|
bleeck@4
|
21 % applied to the GUI before sr_questionbox_OpeningFunction gets called. An
|
bleeck@4
|
22 % unrecognized property name or invalid value makes property application
|
bleeck@4
|
23 % stop. All inputs are passed to sr_questionbox_OpeningFcn via varargin.
|
bleeck@4
|
24 %
|
bleeck@4
|
25 % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
|
bleeck@4
|
26 % instance to run (singleton)".
|
bleeck@4
|
27 %
|
bleeck@4
|
28 % See also: GUIDE, GUIDATA, GUIHANDLES
|
bleeck@4
|
29
|
bleeck@4
|
30 % Edit the above text to modify the response to help sr_questionbox
|
bleeck@4
|
31
|
bleeck@4
|
32 % Last Modified by GUIDE v2.5 14-Mar-2003 17:30:37
|
bleeck@4
|
33
|
bleeck@4
|
34 % Begin initialization code - DO NOT EDIT
|
bleeck@4
|
35 gui_Singleton = 1;
|
bleeck@4
|
36 gui_State = struct('gui_Name', mfilename, ...
|
bleeck@4
|
37 'gui_Singleton', gui_Singleton, ...
|
bleeck@4
|
38 'gui_OpeningFcn', @sr_questionbox_OpeningFcn, ...
|
bleeck@4
|
39 'gui_OutputFcn', @sr_questionbox_OutputFcn, ...
|
bleeck@4
|
40 'gui_LayoutFcn', [] , ...
|
bleeck@4
|
41 'gui_Callback', []);
|
bleeck@4
|
42 if nargin & isstr(varargin{1})
|
bleeck@4
|
43 gui_State.gui_Callback = str2func(varargin{1});
|
bleeck@4
|
44 end
|
bleeck@4
|
45
|
bleeck@4
|
46 if nargout
|
bleeck@4
|
47 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
|
bleeck@4
|
48 else
|
bleeck@4
|
49 gui_mainfcn(gui_State, varargin{:});
|
bleeck@4
|
50 end
|
bleeck@4
|
51 % End initialization code - DO NOT EDIT
|
bleeck@4
|
52
|
bleeck@4
|
53
|
bleeck@4
|
54 % --- Executes just before sr_questionbox is made visible.
|
bleeck@4
|
55 function sr_questionbox_OpeningFcn(hObject, eventdata, handles, varargin)
|
bleeck@4
|
56 % This function has no output args, see OutputFcn.
|
bleeck@4
|
57 % hObject handle to figure
|
bleeck@4
|
58 % eventdata reserved - to be defined in a future version of MATLAB
|
bleeck@4
|
59 % handles structure with handles and user data (see GUIDATA)
|
bleeck@4
|
60 % varargin command line arguments to sr_questionbox (see VARARGIN)
|
bleeck@4
|
61
|
bleeck@4
|
62 % Choose default command line output for sr_questionbox
|
bleeck@4
|
63 handles.output = hObject;
|
bleeck@4
|
64
|
bleeck@4
|
65 old_sr=varargin{1};
|
bleeck@4
|
66 handles.old_sr=old_sr;
|
bleeck@4
|
67 handles.output=old_sr;
|
bleeck@4
|
68
|
bleeck@4
|
69 set(handles.edit1,'String',old_sr);
|
bleeck@4
|
70
|
bleeck@4
|
71
|
bleeck@4
|
72 % Update handles structure
|
bleeck@4
|
73 guidata(hObject, handles);
|
bleeck@4
|
74
|
bleeck@4
|
75 % do modal
|
bleeck@4
|
76 % UIWAIT makes sr_questionbox wait for user response (see UIRESUME)
|
bleeck@4
|
77 uiwait(handles.figure1);
|
bleeck@4
|
78
|
bleeck@4
|
79
|
bleeck@4
|
80 % --- Outputs from this function are returned to the command line.
|
bleeck@4
|
81 function varargout = sr_questionbox_OutputFcn(hObject, eventdata, handles)
|
bleeck@4
|
82 % varargout cell array for returning output args (see VARARGOUT);
|
bleeck@4
|
83 % hObject handle to figure
|
bleeck@4
|
84 % eventdata reserved - to be defined in a future version of MATLAB
|
bleeck@4
|
85 % handles structure with handles and user data (see GUIDATA)
|
bleeck@4
|
86
|
bleeck@4
|
87 % Get default command line output from handles structure
|
bleeck@4
|
88 varargout{1} = handles.output;
|
bleeck@4
|
89 close(handles.figure1);
|
bleeck@4
|
90
|
bleeck@4
|
91
|
bleeck@4
|
92 % --- Executes during object creation, after setting all properties.
|
bleeck@4
|
93 function edit1_CreateFcn(hObject, eventdata, handles)
|
bleeck@4
|
94 % hObject handle to edit1 (see GCBO)
|
bleeck@4
|
95 % eventdata reserved - to be defined in a future version of MATLAB
|
bleeck@4
|
96 % handles empty - handles not created until after all CreateFcns called
|
bleeck@4
|
97
|
bleeck@4
|
98 % Hint: edit controls usually have a white background on Windows.
|
bleeck@4
|
99 % See ISPC and COMPUTER.
|
bleeck@4
|
100 if ispc
|
bleeck@4
|
101 set(hObject,'BackgroundColor','white');
|
bleeck@4
|
102 else
|
bleeck@4
|
103 set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
|
bleeck@4
|
104 end
|
bleeck@4
|
105
|
bleeck@4
|
106
|
bleeck@4
|
107
|
bleeck@4
|
108 function edit1_Callback(hObject, eventdata, handles)
|
bleeck@4
|
109 % hObject handle to edit1 (see GCBO)
|
bleeck@4
|
110 % eventdata reserved - to be defined in a future version of MATLAB
|
bleeck@4
|
111 % handles structure with handles and user data (see GUIDATA)
|
bleeck@4
|
112
|
bleeck@4
|
113 % Hints: get(hObject,'String') returns contents of edit1 as text
|
bleeck@4
|
114 % str2double(get(hObject,'String')) returns contents of edit1 as a double
|
bleeck@4
|
115
|
bleeck@4
|
116 num=str2num(get(handles.edit1,'String'));
|
bleeck@4
|
117 if isempty(num)
|
bleeck@4
|
118 num=handles.old_sr;
|
bleeck@4
|
119 end
|
bleeck@4
|
120 if num<1
|
bleeck@4
|
121 num=handles.old_sr;
|
bleeck@4
|
122 end
|
bleeck@4
|
123 set(handles.edit1,'String',num2str(num));
|
bleeck@4
|
124
|
bleeck@4
|
125 handles.output=num;
|
bleeck@4
|
126 guidata(hObject, handles);
|
bleeck@4
|
127
|
bleeck@4
|
128 % --- Executes on button press in pushbutton1.
|
bleeck@4
|
129 function pushbutton1_Callback(hObject, eventdata, handles)
|
bleeck@4
|
130 % hObject handle to pushbutton1 (see GCBO)
|
bleeck@4
|
131 % eventdata reserved - to be defined in a future version of MATLAB
|
bleeck@4
|
132 % handles structure with handles and user data (see GUIDATA)
|
bleeck@4
|
133 handles.output=str2num(get(handles.edit1,'String'));
|
bleeck@4
|
134 guidata(hObject, handles);
|
bleeck@4
|
135 uiresume;
|
bleeck@4
|
136
|
bleeck@4
|
137 % --- Executes on button press in pushbutton2.
|
bleeck@4
|
138 function pushbutton2_Callback(hObject, eventdata, handles)
|
bleeck@4
|
139 % hObject handle to pushbutton2 (see GCBO)
|
bleeck@4
|
140 % eventdata reserved - to be defined in a future version of MATLAB
|
bleeck@4
|
141 % handles structure with handles and user data (see GUIDATA)
|
bleeck@4
|
142 handles.output=handles.old_sr;
|
bleeck@4
|
143 guidata(hObject, handles);
|
bleeck@4
|
144 uiresume;
|
bleeck@4
|
145
|