Support editable GUIDE fig layout
Agent-Logs-Url: https://github.com/kk14222/3D_EDFM_SIM-X/sessions/a128ab7f-6b94-4048-a847-f2dc37bbe0ab Co-authored-by: kk14222 <217880052+kk14222@users.noreply.github.com>
This commit is contained in:
co-authored by
kk14222
parent
dd42a8f138
commit
f10831f06b
@@ -11,7 +11,7 @@ if nargin > 0 && ischar(varargin{1})
|
||||
end
|
||||
|
||||
startup;
|
||||
handles = createEDFMSimulatorGuideLayout();
|
||||
handles = loadOrCreateGuideLayout();
|
||||
fig = handles.UIFigure;
|
||||
app = EDFMGuideApp(handles);
|
||||
app.Controller = EDFMAppController(app);
|
||||
@@ -25,6 +25,17 @@ if nargout > 0
|
||||
end
|
||||
end
|
||||
|
||||
function handles = loadOrCreateGuideLayout()
|
||||
figFile = fullfile(fileparts(mfilename('fullpath')), 'EDFMSimulatorGuide.fig');
|
||||
if exist(figFile, 'file') == 2
|
||||
fig = openfig(figFile, 'reuse', 'invisible');
|
||||
handles = guihandles(fig);
|
||||
handles.UIFigure = fig;
|
||||
else
|
||||
handles = createEDFMSimulatorGuideLayout();
|
||||
end
|
||||
end
|
||||
|
||||
function configureGuideCallbacks(app, fig)
|
||||
app.NewConfigButton.ButtonPushedFcn = @(src, event) onNewConfig(fig);
|
||||
app.LoadTemplateButton.ButtonPushedFcn = @(src, event) onLoadTemplate(fig);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
function figPath = build_edfm_guide_fig(figPath)
|
||||
%BUILD_EDFM_GUIDE_FIG Generate an editable GUIDE FIG file for MATLAB R2022a.
|
||||
% FIGPATH = BUILD_EDFM_GUIDE_FIG() creates EDFMSimulatorGuide.fig next to
|
||||
% EDFMSimulatorGuide.m. Open the generated FIG with GUIDE to inspect or
|
||||
% adjust the converted drag-and-drop style layout.
|
||||
|
||||
if nargin < 1 || strlength(string(figPath)) == 0
|
||||
figPath = fullfile(fileparts(mfilename('fullpath')), 'EDFMSimulatorGuide.fig');
|
||||
end
|
||||
|
||||
startup;
|
||||
handles = createEDFMSimulatorGuideLayout();
|
||||
fig = handles.UIFigure;
|
||||
set(fig, 'Visible', 'off');
|
||||
savefig(fig, figPath);
|
||||
close(fig);
|
||||
end
|
||||
Reference in New Issue
Block a user