diff --git a/gui_support/app/EDFMSimulatorGuide.m b/gui_support/app/EDFMSimulatorGuide.m index 7d308ad..088b5ad 100644 --- a/gui_support/app/EDFMSimulatorGuide.m +++ b/gui_support/app/EDFMSimulatorGuide.m @@ -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); diff --git a/gui_support/app/build_edfm_guide_fig.m b/gui_support/app/build_edfm_guide_fig.m new file mode 100644 index 0000000..3938529 --- /dev/null +++ b/gui_support/app/build_edfm_guide_fig.m @@ -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