IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
buggui.m
Go to the documentation of this file.
1 %>@ingroup guigroup usercomm
2 %>@file
3 %>@brief buggui Dialog
4 
5 %> @cond
6 function varargout = buggui(varargin)
7 % Last Modified by GUIDE v2.5 13-Jan-2012 17:06:33
8 
9 % Begin initialization code - DO NOT EDIT
10 gui_Singleton = 1;
11 gui_State = struct('gui_Name', mfilename, ...
12  'gui_Singleton', gui_Singleton, ...
13  'gui_OpeningFcn', @buggui_OpeningFcn, ...
14  'gui_OutputFcn', @buggui_OutputFcn, ...
15  'gui_LayoutFcn', [] , ...
16  'gui_Callback', []);
17 if nargin && ischar(varargin{1})
18  gui_State.gui_Callback = str2func(varargin{1});
19 end
20 
21 if nargout
22  [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
23 else
24  gui_mainfcn(gui_State, varargin{:});
25 end
26 % End initialization code - DO NOT EDIT
27 
28 % --- Executes just before buggui is made visible.
29 function buggui_OpeningFcn(hObject, eventdata, handles, varargin)
30 % This function has no output args, see OutputFcn.
31 % hObject handle to figure
32 % eventdata reserved - to be defined in a future version of MATLAB
33 % handles structure with handles and user data (see GUIDATA)
34 % varargin command line arguments to buggui (see VARARGIN)
35 
36 % Update handles structure
37 guidata(hObject, handles);
38 
39 % Determine the position of the dialog - centered on the callback figure
40 % if available, else, centered on the screen
41 FigPos=get(0,'DefaultFigurePosition');
42 OldUnits = get(hObject, 'Units');
43 set(hObject, 'Units', 'pixels');
44 OldPos = get(hObject,'Position');
45 FigWidth = OldPos(3);
46 FigHeight = OldPos(4);
47 if 0 || isempty(gcbf)
48 % ScreenUnits=get(0,'Units');
49 % set(0,'Units','pixels');
50 % ScreenSize=get(0,'ScreenSize');
51 % set(0,'Units',ScreenUnits);
52 %
53 % FigPos(1)=1/2*(ScreenSize(3)-FigWidth);
54 % FigPos(2)=2/3*(ScreenSize(4)-FigHeight);
55 else
56  GCBFOldUnits = get(gcbf,'Units');
57  set(gcbf,'Units','pixels');
58  GCBFPos = get(gcbf,'Position');
59  set(gcbf,'Units',GCBFOldUnits);
60  FigPos(1:2) = [(GCBFPos(1) + GCBFPos(3) / 2) - FigWidth / 2, ...
61  (GCBFPos(2) + GCBFPos(4) / 2) - FigHeight / 2];
62 end
63 FigPos(3:4)=[FigWidth FigHeight];
64 set(hObject, 'Position', FigPos);
65 set(hObject, 'Units', OldUnits);
66 
67 % Show a question icon from dialogicons.mat - variables questIconData
68 % and questIconMap
69 
70 IM = imread('bug.png');
71 
72 % load dialogicons.mat
73 
74 % IconData=questIconData;
75 % questIconMap(256,:) = get(handles.figure1, 'Color');
76 % IconCMap=questIconMap;
77 
78 % Img=image(IconData, 'Parent', handles.axes1);
79 % set(handles.figure1, 'Colormap', IconCMap);
80 
81 Img = image(IM, 'Parent', handles.axes1);
82 
83 set(handles.axes1, ...
84  'Visible', 'off', ...
85  'YDir' , 'reverse' , ...
86  'XLim' , get(Img,'XData'), ...
87  'YLim' , get(Img,'YData') ...
88  );
89 
90 % Make the GUI modal
91 set(handles.figure1,'WindowStyle','modal')
92 
93 
94 if ~isempty(varargin)
95  ME = varargin{1};
96  set(handles.text_message, 'String', ME.message);
97  set(handles.edit_stack, 'String', ME.getReport());
98 end;
99 
100 gui_set_position(hObject);
101 
102 % UIWAIT makes buggui wait for user response (see UIRESUME)
103 uiwait(handles.figure1);
104 
105 
106 
107 % --- Outputs from this function are returned to the command line.
108 function varargout = buggui_OutputFcn(hObject, eventdata, handles)
109 % varargout cell array for returning output args (see VARARGOUT);
110 % hObject handle to figure
111 % eventdata reserved - to be defined in a future version of MATLAB
112 % handles structure with handles and user data (see GUIDATA)
113 
114 % The figure can be deleted now
115 delete(handles.figure1);
116 
117 % --- Executes on button press in pushbutton1.
118 function pushbutton1_Callback(hObject, eventdata, handles)
119 % hObject handle to pushbutton1 (see GCBO)
120 % eventdata reserved - to be defined in a future version of MATLAB
121 % handles structure with handles and user data (see GUIDATA)
122 
123 handles.output = get(hObject,'String');
124 
125 % Update handles structure
126 guidata(hObject, handles);
127 
128 % Use UIRESUME instead of delete because the OutputFcn needs
129 % to get the updated handles structure.
130 uiresume(handles.figure1);
131 
132 % --- Executes on button press in pushbutton2.
133 function pushbutton2_Callback(hObject, eventdata, handles)
134 % hObject handle to pushbutton2 (see GCBO)
135 % eventdata reserved - to be defined in a future version of MATLAB
136 % handles structure with handles and user data (see GUIDATA)
137 
138 handles.output = get(hObject,'String');
139 
140 % Update handles structure
141 guidata(hObject, handles);
142 
143 % Use UIRESUME instead of delete because the OutputFcn needs
144 % to get the updated handles structure.
145 uiresume(handles.figure1);
146 
147 
148 % --- Executes when user attempts to close figure1.
149 function figure1_CloseRequestFcn(hObject, eventdata, handles)
150 % hObject handle to figure1 (see GCBO)
151 % eventdata reserved - to be defined in a future version of MATLAB
152 % handles structure with handles and user data (see GUIDATA)
153 
154 if isequal(get(handles.figure1, 'waitstatus'), 'waiting')
155  % The GUI is still in UIWAIT, us UIRESUME
156  uiresume(handles.figure1);
157 else
158  % The GUI is no longer waiting, just close it
159  delete(handles.figure1);
160 end
161 
162 
163 % --- Executes on key press over figure1 with no controls selected.
164 function figure1_KeyPressFcn(hObject, eventdata, handles)
165 % hObject handle to figure1 (see GCBO)
166 % eventdata reserved - to be defined in a future version of MATLAB
167 % handles structure with handles and user data (see GUIDATA)
168 
169 % Check for "enter" or "escape"
170 if isequal(get(hObject,'CurrentKey'),'escape')
171  % User said no by hitting escape
172  handles.output = 'No';
173 
174  % Update handles structure
175  guidata(hObject, handles);
176 
177  uiresume(handles.figure1);
178 end
179 
180 if isequal(get(hObject,'CurrentKey'),'return')
181  uiresume(handles.figure1);
182 end
183 
184 
185 
186 function edit1_Callback(hObject, eventdata, handles)
187 % hObject handle to edit1 (see GCBO)
188 % eventdata reserved - to be defined in a future version of MATLAB
189 % handles structure with handles and user data (see GUIDATA)
190 
191 % Hints: get(hObject,'String') returns contents of edit1 as text
192 % str2double(get(hObject,'String')) returns contents of edit1 as a double
193 
194 
195 % --- Executes during object creation, after setting all properties.
196 function edit1_CreateFcn(hObject, eventdata, handles)
197 % hObject handle to edit1 (see GCBO)
198 % eventdata reserved - to be defined in a future version of MATLAB
199 % handles empty - handles not created until after all CreateFcns called
200 
201 % Hint: edit controls usually have a white background on Windows.
202 % See ISPC and COMPUTER.
203 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
204  set(hObject,'BackgroundColor','white');
205 end
206 
207 
208 
209 function edit_stack_Callback(hObject, eventdata, handles)
210 % hObject handle to edit_stack (see GCBO)
211 % eventdata reserved - to be defined in a future version of MATLAB
212 % handles structure with handles and user data (see GUIDATA)
213 
214 % Hints: get(hObject,'String') returns contents of edit_stack as text
215 % str2double(get(hObject,'String')) returns contents of edit_stack as a double
216 
217 
218 % --- Executes during object creation, after setting all properties.
219 function edit_stack_CreateFcn(hObject, eventdata, handles)
220 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
221  set(hObject,'BackgroundColor','white');
222 end
223 
224 
225 
226 function edit__Callback(hObject, eventdata, handles)
227 
228 function edit__CreateFcn(hObject, eventdata, handles)
229 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
230  set(hObject,'BackgroundColor','white');
231 end
232 %> @endcond
function figure1_KeyPressFcn(in hObject, in eventdata, in handles)
function edit1_Callback(in hObject, in eventdata, in handles)
function figure1_CloseRequestFcn(in hObject, in eventdata, in handles)
function gui_set_position(in hObject)
Analysis Session (AS) base class.
Definition: as.m:6
function edit1_CreateFcn(in hObject, in eventdata, in handles)
function pushbutton1_Callback(in hObject, in eventdata, in handles)
function pushbutton2_Callback(in hObject, in eventdata, in handles)