diff --git a/@Cell/Cell.m b/@Cell/Cell.m index 1a5d8cf188f02beae7192c42dd8f979d6bbd56e8..7ecf380e0da09da6d0027cff556ebee56c8f4466 100644 --- a/@Cell/Cell.m +++ b/@Cell/Cell.m @@ -7,7 +7,18 @@ classdef Cell < handle text = '' end - methods + methods + function str = get_matlab_string(object) + str = object.text; + if size(str) > 0 + s = [str(1,:)]; + for j = 2:size(str,1) + s = [s ' ' str(j,:)]; + end + str = s; + end + end + function str = get_user_string(object) str = object.text; end diff --git a/@GUI/check_call.m b/@GUI/check_call.m index b97a5bae48d66f6a2fc22d6015d2ed165056d66e..c66dd4d3b9dc03ab63fd4438700b7667083c1893 100644 --- a/@GUI/check_call.m +++ b/@GUI/check_call.m @@ -17,10 +17,11 @@ msg = object.check_inputs; if (isempty(msg)) set(object.function_inputs_control,'BackgroundColor',[1 1 1]); msg = object.check_grid_condition(object.data.left_cond); %TODO: Rename this function - if object.multi_mode == 0 - msg = [msg object.check_grid_condition(object.Grid1)]; + + if object.multi_mode == 0 && ~(object.data.top_cond.length == 1 && object.data.top_cond.max_width == 1 && (strcmp(object.data.top_cond.get_cell(1).get_user_string, '') || isempty(object.data.top_cond.get_cell(1).get_user_string))) + msg = [msg object.check_grid_condition(object.data.top_cond)]; end - msg = [msg object.check_grid_result(object.Grid0)]; + msg = [msg object.check_grid_result(object.data.outputs_grid)]; else set(object.function_inputs_control,'BackgroundColor',[0.92 0.65 0.65]); end diff --git a/@GUI/check_grid_condition.m b/@GUI/check_grid_condition.m index bf80ed8dfeb9dbd4aa038a70d29e4857696cab09..3977822759e59b7b58c789988a2dc324bbbc7368 100644 --- a/@GUI/check_grid_condition.m +++ b/@GUI/check_grid_condition.m @@ -12,24 +12,17 @@ % Organization: McMaster Centre for Software Certification %TODO: Merge this back into the grid itself -function msg = check_grid_condition(object,grid) +function msg = check_grid_condition(object,grid_container,grid) +if nargin == 2 + msg = check_grid_condition(object, grid_container, grid_container.grid); + return ; +end + msg = []; -for i = 1:size(grid.grid,2) +for i = 1:size(grid,2) error = ''; - string = get(grid.cells(i).cond,'String'); - - if size(string) > 0 - s = [string(1,:)]; - for j = 2:size(string,1) - s = [s ' ' string(j,:)]; - end - string = s; - end - - if ( strcmp(string,'') || isempty(string)) && i == 1 && isempty(grid.parent_grid) && size(grid.cells,2) == 1 - break; - end + string = grid{i}.get_matlab_string(); % if the string is empty indicating that the table is 1 % dimensional or the string is "otherwise" skip the syntax @@ -50,20 +43,22 @@ for i = 1:size(grid.grid,2) msg = [msg error sprintf('\n')]; % set tooltip string of cell to error msg - set(grid.cells(i).cond,'TooltipString',error); + % TODO Renenable + % set(grid.cells(i).cond,'TooltipString',error); % change background colour - grid.cells(i).flag_cell(1); + % TODO Renenable + % grid.cells(i).flag_cell(1); else % reset tooltip and colour if no error found - set(grid.cells(i).cond,'TooltipString','') - grid.cells(i).flag_cell(0); + % TODO Renenable + % set(grid.cells(i).cond,'TooltipString','') + % TODO Renenable + % grid.cells(i).flag_cell(0); end % recurse through subgrid - if(~isempty(grid.cells(i).subgrid)) - msg = [msg object.check_grid_condition(grid.cells(i).subgrid)]; - end + msg = [msg object.check_grid_condition(grid_container, grid{i}.grid)]; end diff --git a/@GUI/check_grid_result.m b/@GUI/check_grid_result.m index c174ec42d98db94537dc21260a8cd410b4127775..2819f1f931508c23bc81c55eb1a9b71f47465192 100644 --- a/@GUI/check_grid_result.m +++ b/@GUI/check_grid_result.m @@ -11,31 +11,31 @@ % Organization: McMaster Centre for Software Certification function msg = check_grid_result(object,grid) msg = []; -for i = 1:size(grid.Cells,2) - error = ''; - string = get(grid.Cells(i).result,'String'); - - - error = object.check_matlab_syntax_condition(char(string),1); - if isempty(error) - if (strcmp(string,'') || isempty(string)) - error = 'Cell is empty'; +for i = 1:grid.width + for j = 1:grid.height + string = grid.get_cell(j, i).get_matlab_string(); + + + error = object.check_matlab_syntax_condition(char(string),1); + if isempty(error) + if (strcmp(string,'') || isempty(string)) + error = 'Cell is empty'; + end + end + if ~isempty(error) + msg = [msg sprintf('\n')]; + + msg = [msg 'Result -> ' char(string) sprintf('\n')]; + msg = [msg error sprintf('\n')]; + + % TODO Re-enable! + %set(grid.Cells(i).result,'TooltipString',error); + %grid.Cells(i).flag_cell(1); + else + %set(grid.Cells(i).result,'TooltipString',''); + %grid.Cells(i).flag_cell(0); end end - if ~isempty(error) - msg = [msg sprintf('\n')]; - - msg = [msg 'Result -> ' char(string) sprintf('\n')]; - msg = [msg error sprintf('\n')]; - - - set(grid.Cells(i).result,'TooltipString',error); - grid.Cells(i).flag_cell(1); - else - set(grid.Cells(i).result,'TooltipString',''); - grid.Cells(i).flag_cell(0); - end - end end diff --git a/@GUI/save_data.m b/@GUI/save_data.m index 52c555b732a97114c66a7ea5efa62f7a045b6559..f64f337cccb517cef2d545c0cb78008cb7d85e03 100644 --- a/@GUI/save_data.m +++ b/@GUI/save_data.m @@ -8,17 +8,14 @@ % Author: Colin Eles elesc@mcmaster.ca % Organization: McMaster Centre for Software Certification function [] = save_data(object) -save_conditions(object,object.Grid2); -save_conditions(object,object.Grid1); -save_results(object,object.Grid0); % depricated object.function_name_text = get(object.function_name_control,'String'); object.function_inputs_text = get(object.function_inputs_control,'String'); % new storage -object.Data.function_name = get(object.function_name_control,'String'); -object.Data.function_inputs = get(object.function_inputs_control,'String'); -object.Data.checked = object.pvs_checked; -object.Data.multi_mode = object.multi_mode; +object.data.function_name = get(object.function_name_control,'String'); +object.data.function_inputs = get(object.function_inputs_control,'String'); +object.data.checked = object.pvs_checked; +object.data.multi_mode = object.multi_mode; set.set = 1; set.inputs = object.settings.pvs_includes; diff --git a/@TableGridDraw/draw_onto.m b/@TableGridDraw/draw_onto.m index 6a103c7d51de478093b03bc4c583e6487bab4b6e..b7ff6f3e2e76ce105a14d75083efaa79ca95a8d2 100644 --- a/@TableGridDraw/draw_onto.m +++ b/@TableGridDraw/draw_onto.m @@ -6,7 +6,7 @@ function draw_onto( object, parent_handle ) % notify when its necessary. %Need to invert y, so need total size - [x, y] = object.get_bounding_box(); + [~, y] = object.get_bounding_box(); % First delete an extra controls if size(object.controls, 2) > object.my_table_grid.width