-
Notifications
You must be signed in to change notification settings - Fork 0
/
ValvesSection.m
66 lines (54 loc) · 2.18 KB
/
ValvesSection.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
% [x, y] = ValvesSection(obj, action, x, y)
%
% Section that takes care of times for the water valves, and pneumatic valve.
%
% PARAMETERS:
% -----------
%
% obj Default object argument.
%
% action One of:
% 'init' To initialise the section and set up the GUI
% for it
%
% 'reinit' Delete all of this section's GUIs and data,
% and reinit, at the same position on the same
% figure as the original section GUI was placed.
%
% x, y Relevant to action = 'init'; they indicate the initial
% position to place the GUI at, in the current figure window
%
%
% RETURNS:
% --------
%
% [x, y] When action == 'init', returns x and y, pixel positions on
% the current figure, updated after placing of this section's GUI.
%
function [x, y] = ValvesSection(obj, action, x, y)
GetSoloFunctionArgs;
global valves_properties; % Defined in mystartup.m.
switch action
case 'init',
% Save the figure and the position in the figure where we are
% going to start adding GUI elements:
SoloParamHandle(obj, 'my_gui_info', 'value', [x y gcf]);
% --- Water valve times
EditParam(obj, 'WaterValveTime', valves_properties.water_valve_time, x, y); next_row(y);
SoloFunctionAddVars('make_and_upload_state_matrix', 'ro_args', {'WaterValveTime'});
EditParam(obj, 'AirpuffTime', valves_properties.airpuff_time, x, y); next_row(y);
SoloFunctionAddVars('make_and_upload_state_matrix', 'ro_args', {'AirpuffTime'});
SubheaderParam(obj, 'title', 'Valves', x, y);
next_row(y, 1.5);
case 'reinit',
currfig = gcf;
% Get the original GUI position and figure:
x = my_gui_info(1); y = my_gui_info(2); figure(my_gui_info(3));
% Delete all SoloParamHandles who belong to this object and whose
% fullname starts with the name of this mfile:
delete_sphandle('owner',['^' class(obj) '$'],'fullname',['^' mfilename]);
% Reinitialise at the original GUI position and figure:
feval(mfilename, obj, 'init', x, y);
% Restore the current figure:
figure(currfig);
end;