Newer
Older
classdef GUI < handle
properties
% vertical grid
Grid2 = [];
% horizontal grid
Grid1 = [];
%output grid
Grid0 = [];
main_fig = [];
frame = [];
fig = [];
scroll_v = [];
edit_tog = [];
save_pb = [];
pvs_pb = [];
close_pb = [];
save_ext_pb = [];
check_pb = [];
input_pb = [];
settings_pb = [];
function_name_control = [];
function_name_text = [];
function_inputs_text = [];
function_inputs_control = [];
edit = 1;
initialized = 0;
block_handle = [];
% height of header where buttons and text is
header_height = 100;
% window size
Colin Eles
committed
fig_height = 600;
fig_width = 800;
% space inbetween buttons in header
pb_offset = 5;
% width of push buttons in header
pb_width = 80;
% height of push buttons in header
pb_height = 40;
% width of text boxes
text_width = 250;
name_label = [];
input_label = [];
Colin Eles
committed
Data = [];
PVS = [];
end
methods
%% GUI
% constructor
% inputs:
% h:double - handle to Tabular block in model
% outputs;
% obj:GUI - object that is created
function obj = GUI(h)
obj.block_handle = h;
end
Colin Eles
committed
function [] = setData(obj,Data)
obj.Data = Data;
obj.Grid0 = Data.Grid0;
obj.Grid1 = Data.Grid1;
obj.Grid2 = Data.Grid2;
obj.function_name_text = Data.function_name;
obj.function_inputs_text = Data.function_inputs;
Colin Eles
committed
end
%% init
% initialize the gui
% inputs:
% obj:GUI - GUI object
% outputs;
% none
function [] = init(obj)
% create the handles for the gui objects
% main figure
obj.fig = figure('units','pixels',...
'position',[0 0 obj.fig_width obj.fig_height],...
'menubar','none',...
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
'numbertitle','off',...
'resize','on',...
'Name',get_param(obj.block_handle,'Name'),...
'CloseRequestFcn',@(src,event)close_fig(obj,src,event),...
'ResizeFcn',@(src,event)resize_fig(obj,src,event));
% edit button
obj.edit_tog = uicontrol('style','toggle',...
'units','pix',...
'string','Edit',...
'HorizontalAlign','left',...
'Parent',obj.fig,...
'Value',obj.edit,...
'callback',@(src,event)edit_tog_call(obj,src,event));
% Save button
obj.save_pb = uicontrol('style','push',...
'units','pix',...
'string','Save',...
'HorizontalAlign','left',...
'Parent',obj.fig,...
'callback',@(src,event)save_call(obj,src,event));
% Close button
obj.close_pb = uicontrol('style','push',...
'units','pix',...
'string','Close',...
'HorizontalAlign','left',...
'Parent',obj.fig,...
'callback',@(src,event)close_fig(obj,src,event));
% Save external button
obj.save_ext_pb = uicontrol('style','push',...
'units','pix',...
'string','Save Ext',...
'HorizontalAlign','left',...
'Parent',obj.fig,...
'callback',@(src,event)save_ext_call(obj,src,event));
% PVS button
obj.pvs_pb = uicontrol('style','push',...
'units','pix',...
'string','PVS',...
'HorizontalAlign','left',...
'Parent',obj.fig,...
'callback',@(src,event)pvs_ext_call(obj,src,event));
% Check button
obj.check_pb = uicontrol('style','push',...
'units','pix',...
'string','Check',...
'HorizontalAlign','left',...
'Parent',obj.fig,...
'callback',@(src,event)check_call(obj,src,event));
% Input/Output button
obj.input_pb = uicontrol('style','push',...
'units','pix',...
'string','Ports',...
'HorizontalAlign','left',...
'Parent',obj.fig,...
'callback',@(src,event)input_call(obj,src,event));
% Input/Output button
obj.settings_pb = uicontrol('style','push',...
'units','pix',...
'string','Settings',...
'HorizontalAlign','left',...
'Parent',obj.fig,...
'callback',@(src,event)settings_call(obj,src,event));
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
% Expression Name Label
obj.name_label = uicontrol('style','text',...
'string','Expression Name',...
'HorizontalAlign','right',...
'BackgroundColor',get(obj.fig,'Color'));
% Expression Name Edit box
obj.function_name_control = uicontrol('style','edit',...
'units','pix',...
'Parent',obj.fig,...
'HorizontalAlign','center',...
'FontWeight','bold',...
'FontSize',12,...
'Max',2.0,...
'BackgroundColor',[1 1 1]);
% input list label
obj.input_label = uicontrol('style','text',...
'string','Inputs',...
'HorizontalAlign','right',...
'BackgroundColor',get(obj.fig,'Color'));
% input list edit box
obj.function_inputs_control = uicontrol('style','edit',...
'units','pix',...
'Parent',obj.fig,...
'HorizontalAlign','center',...
'FontWeight','bold',...
'Max',2.0,...
'FontSize',12,...
'BackgroundColor',[1 1 1]);
% load the function name and inputs
if (~isempty(obj.function_name_text))
set(obj.function_name_control,'String',obj.function_name_text);
end
if (~isempty(obj.function_inputs_text))
set(obj.function_inputs_control,'String',obj.function_inputs_text);
end
Loading
Loading full blame...