diff --git a/functions/utilities/exportFigureGUI.m b/functions/utilities/exportFigureGUI.m index a4fa852a4e58a233f0baf4eb16f57988cd17e5f3..30eaf8cbc5f5358685a2cb97e2e1dc14c991cbf2 100644 --- a/functions/utilities/exportFigureGUI.m +++ b/functions/utilities/exportFigureGUI.m @@ -140,6 +140,7 @@ figSelectionDropDown = uidropdown(fig, ... % Automatically update preview if only one figure exists if isscalar(figHandles) + updateDropdown(); updatePreview(); end @@ -359,7 +360,7 @@ allDefaultButton = uibutton(fig, 'Text', 'Reset All', ... end % Move from background to foreground current figure uistack(selectedFig,'top') - updateDropdown(); + % updateDropdown(); if isempty(selectedFig) && isscalar(figHandles), selectedFig = figHandles(1); end if isempty(selectedFig) || ~isvalid(selectedFig), return; end @@ -369,51 +370,52 @@ allDefaultButton = uibutton(fig, 'Text', 'Reset All', ... % Copy the axes informations check = size(obj.Children); - if check(1) == 1 - if satelliteMapColorsBox.Value, satelliteMapColorsBox.Value = false; end - - newAx = obj.Children; - hold(newAx, 'on'); - end - if check(1) == 2 % geoplots or 3d plots or tabfigures - if isa(obj.Children(1), 'matlab.ui.container.TabGroup') + switch check(1) + case 0 + return; + case 1 if satelliteMapColorsBox.Value, satelliteMapColorsBox.Value = false; end - numTabs = numel(obj.Children(1).Children); % Get number of tabs - originalFigNum = obj.Number; % Get the original figure number + newAx = obj.Children; + hold(newAx, 'on'); + case 2 + if isa(obj.Children(1), 'matlab.ui.container.TabGroup') + if satelliteMapColorsBox.Value, satelliteMapColorsBox.Value = false; end - for i = 1:numTabs - newFigName = sprintf('Figure %d - Tab %d', originalFigNum, i); - newFig = figure('Name', newFigName, 'NumberTitle', 'off'); + numTabs = numel(obj.Children(1).Children); % Get number of tabs + originalFigNum = obj.Number; % Get the original figure number - newAx = copyobj(obj.Children(1).Children(i).Children, newFig); + for i = 1:numTabs + newFigName = sprintf('Figure %d - Tab %d', originalFigNum, i); + newFig = figure('Name', newFigName, 'NumberTitle', 'off'); - set(newAx, 'Position', get(gca, 'Position')); - hold(newAx, 'on'); - end - delete(obj); - else - if strcmp(obj.Children(2).Type, 'geoaxes') - satelliteMapColorsBox.Value = true; + newAx = copyobj(obj.Children(1).Children(i).Children, newFig); + + set(newAx, 'Position', get(gca, 'Position')); + hold(newAx, 'on'); + end + delete(obj); else - satelliteMapColorsBox.Value = false; + if strcmp(obj.Children(2).Type, 'geoaxes') + satelliteMapColorsBox.Value = true; + else + satelliteMapColorsBox.Value = false; + end + newAx = obj.Children(2); + hold(newAx, 'on'); end - newAx = obj.Children(2); - hold(newAx, 'on'); - end - end - if check(1) > 2 - if isa(obj.Children(1), 'matlab.graphics.illustration.Legend') - if satelliteMapColorsBox.Value, satelliteMapColorsBox.Value = false; end + otherwise + if isa(obj.Children(1), 'matlab.graphics.illustration.Legend') + if satelliteMapColorsBox.Value, satelliteMapColorsBox.Value = false; end - newAx = obj.Children(2:end); - hold(newAx(1:check(1)-1), 'on'); - else - if satelliteMapColorsBox.Value, satelliteMapColorsBox.Value = false; end + newAx = obj.Children(2:end); + hold(newAx(1:check(1)-1), 'on'); + else + if satelliteMapColorsBox.Value, satelliteMapColorsBox.Value = false; end - newAx = obj.Children; - hold(newAx, 'on'); - end + newAx = obj.Children; + hold(newAx, 'on'); + end end % Apply user settings @@ -542,8 +544,8 @@ allDefaultButton = uibutton(fig, 'Text', 'Reset All', ... 'WHratio', WHratio, ... 'overwriteFigure', overwriteFigure); - checkboxes = findall(flagsPanel.Children, 'Type', 'uicheckbox'); - set(checkboxes, 'Enable', 'off'); + % checkboxes = findall(flagsPanel.Children, 'Type', 'uicheckbox'); + % set(checkboxes, 'Enable', 'off'); end end