From a0bdecd2570b007ba6a7610d0ae0eb99ab310d1b Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Mon, 22 Jul 2019 12:03:36 -0600
Subject: [PATCH] plot_shock_decomposition: always display all vintage option

---
 src/gui_plot_shock_decomposition.m | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/src/gui_plot_shock_decomposition.m b/src/gui_plot_shock_decomposition.m
index 2f6b3f8..d52ffcb 100644
--- a/src/gui_plot_shock_decomposition.m
+++ b/src/gui_plot_shock_decomposition.m
@@ -348,27 +348,23 @@ handles.pushbuttonClose = uicontrol( ...
         num = num + 1;
         uicontrol( ...
             'Parent', handles.uipanelResults, ...
-            'Tag', 'text8', ...
+            'Tag', 'vintage', ...
             'Style', 'text', ...
             'Units', 'normalized', ...
             'Position', [spc*3 top-num*dheight dwidth*1.5 dheight/2], ...
             'String', 'vintage:', ...
             'HorizontalAlignment', 'left');
 
-        if ~project_info.realtime_shock_decomposition_run
-            enable = 'Off';
-        else
-            enable = 'On';
-        end
         handles.vintage = uicontrol( ...
             'Parent', handles.uipanelResults, ...
             'Tag', 'vintage', ...
+            'String', '0', ...
             'Style', 'edit', ...
             'Units', 'normalized', ...
             'Position', [spc*3+dwidth*1.5 top-num*dheight dwidth*2 dheight/2], ...
-            'Value', 0, ...
-            'Enable', enable);
+            'Value', 0);
 
+        num = num + 1;
         handles.use_shock_groups = uicontrol(...
             'Parent', handles.uipanelResults, ...
             'Style', 'checkbox',...
@@ -380,16 +376,14 @@ handles.pushbuttonClose = uicontrol( ...
     function pushbuttonPlotShockDecomposition_Callback(hObject, ~)
         old_options = options_;
 
-        if project_info.realtime_shock_decomposition_run
-            if ~isnumeric(handles.vintage.Value) ...
-                    || ~isint(num2str(handles.vintage.Value)) ...
-                    || num2str(handles.vintage.Value) < 0
-                gui_tools.show_warning('Vintage must be an integer >= 0');
-                uicontrol(hObject);
-                return
-            end
-            options_.plot_shock_decomp.vintage = handles.vintage.Value;
+        if isempty(str2double(handles.vintage.String)) ...
+                || ~isint(str2double(handles.vintage.String)) ...
+                || str2double(handles.vintage.String) < 0
+            gui_tools.show_warning('Vintage must be an integer >= 0');
+            uicontrol(hObject);
+            return
         end
+        options_.plot_shock_decomp.vintage = str2double(handles.vintage.String);
 
         if handles.colormap.Value ~= 1
             options_.plot_shock_decomp.colormap = handles.colormap.String{handles.colormap.Value};
-- 
GitLab