Newer
Older
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
classdef Settings < handle
%UNTITLED Summary of this class goes here
% Detailed explanation goes here
properties
% settings
pvs_includes = [];
counter_trials = [];
counter_range = [];
% gui elements
fig_width = 400;
fig_height = 300;
open = 0;
fig = [];
button_width = 60;
button_height = 30;
button_offset = 10;
title_height = 30;
label_height = 30;
label_width = 75;
text_offset = 10;
inlude_text = []
count_text = []
range_text = []
end
methods
function obj = Settings()
end
function [] = init(obj)
% initialize the default values of the properties
obj.pvs_includes = [];
obj.counter_trials = 1000;
obj.counter_range = 100;
end
function [] = show(obj)
if (obj.open)
figure(obj.fig)
else
obj.fig = figure('units','pixels',...
'position',[0 0 obj.fig_width obj.fig_height],...
'menubar','none',...
'name','Settings',...
'numbertitle','off',...
'resize','off',...
'CloseRequestFcn',@(src,event)close_fig(obj,src,event));
end
% Ok Button
uicontrol('style','push',...
'units','pix',...
'string','Ok',...
'HorizontalAlign','left',...
'Parent',obj.fig,...
'Position',[obj.fig_width - obj.button_width*3 - obj.button_offset*3, obj.button_offset, obj.button_width, obj.button_height],...
'callback',@(src,event)ok_call(obj,src,event));
% Cancel Button
uicontrol('style','push',...
'units','pix',...
'string','Cancel',...
'HorizontalAlign','left',...
'Parent',obj.fig,...
'Position',[obj.fig_width - obj.button_width*2 - obj.button_offset*2, obj.button_offset, obj.button_width, obj.button_height],...
'callback',@(src,event)cancel_call(obj,src,event));
% Apply Button
uicontrol('style','push',...
'units','pix',...
'string','Apply',...
'HorizontalAlign','left',...
'Parent',obj.fig,...
'Position',[obj.fig_width - obj.button_width - obj.button_offset, obj.button_offset, obj.button_width, obj.button_height],...
'callback',@(src,event)apply_call(obj,src,event));
% main label
uicontrol('style','text',...
'string','Table Tool Settings',...
'HorizontalAlign','center',...
'FontWeight','bold',...
'Parent',obj.fig,...
'Position',[0, obj.fig_height-obj.text_offset-obj.title_height, obj.fig_width, obj.title_height],...
'BackgroundColor',get(obj.fig,'Color'));
panel_height = obj.text_offset*6+obj.label_height*3
panel_width = obj.fig_width-obj.text_offset*2
panel = uipanel('Title','PVS',...
'visible','on',...
'units','pix',...
'BackgroundColor',get(obj.fig,'Color'),...
'Position',[obj.text_offset,obj.fig_height-obj.text_offset-obj.title_height-panel_height,panel_width,panel_height]);
% imports label
uicontrol('style','text',...
'string','Imports:',...
'HorizontalAlign','left',...
'parent',panel,...
'Position',[obj.text_offset, panel_height-obj.text_offset*3-obj.label_height, obj.label_width, obj.label_height],...
'BackgroundColor',get(obj.fig,'Color'));
elipse_width = 20;
% import text box
uicontrol('style','edit',...
'units','pix',...
'Parent',panel,...
'HorizontalAlign','center',...
'BackgroundColor',get(obj.fig,'Color'),...
'Position',[obj.text_offset+obj.label_width, panel_height-obj.text_offset*2-obj.label_height, panel_width - (obj.text_offset*3+obj.label_width+elipse_width), obj.label_height]);
% elipsis button
uicontrol('style','push',...
'units','pix',...
'string','...',...
'HorizontalAlign','left',...
'Parent',panel,...
'Position',[panel_width-elipse_width-obj.text_offset, panel_height-obj.text_offset*2-obj.label_height, elipse_width, obj.label_height],...
'callback',@(src,event)elipse_call(obj,src,event));
% count label
uicontrol('style','text',...
'string','Test Count:',...
'HorizontalAlign','left',...
'parent',panel,...
'Position',[obj.text_offset, panel_height-obj.text_offset*4-obj.label_height*2, obj.label_width, obj.label_height],...
'BackgroundColor',get(obj.fig,'Color'));
% count text box
obj.count_text = uicontrol('style','edit',...
'units','pix',...
'Parent',panel,...
'String',obj.counter_trials,...
'HorizontalAlign','center',...
'BackgroundColor',get(obj.fig,'Color'),...
'Position',[obj.text_offset+obj.label_width, panel_height-obj.text_offset*3-obj.label_height*2, panel_width - (obj.text_offset*2+obj.label_width), obj.label_height]);
% range label
uicontrol('style','text',...
'string','Test Range:',...
'HorizontalAlign','left',...
'parent',panel,...
'Position',[obj.text_offset, panel_height-obj.text_offset*5-obj.label_height*3, obj.label_width, obj.label_height],...
'BackgroundColor',get(obj.fig,'Color'));
% range text box
obj.range_text = uicontrol('style','edit',...
'units','pix',...
'Parent',panel,...
'String',obj.counter_range,...
'HorizontalAlign','center',...
'BackgroundColor',get(obj.fig,'Color'),...
'Position',[obj.text_offset+obj.label_width, panel_height-obj.text_offset*4-obj.label_height*3, panel_width - (obj.text_offset*2+obj.label_width), obj.label_height]);
obj.open = 1;
end
%'Position',[0, obj.fig_height-obj.button_offset-obj.title_height, obj.fig_width, obj.title_height],...
function [] = close_fig(obj,src,event)
delete(obj.fig);
obj.open = 0;
end
function [] = elipse_call(obj,src,event)
uigetfile
end
function [] = apply_call(obj,src,event)
obj.counter_trials = str2num(get(obj.count_text,'String'))
obj.counter_range = str2num(get(obj.range_text,'String'))
end
function [] = cancel_call(obj,src,event)
obj.close_fig([],[]);
end
function [] = ok_call(obj,src,event)
obj.apply_call([],[]);
obj.close_fig([],[]);
end
end
end