Commit 6b8142f6 authored by Matthew Dawson's avatar Matthew Dawson
Browse files

Get the syntax button working along with some draw changes.

The Syntax button works well now, and the save button is starting to work ok.


git-svn-id: https://groke.mcmaster.ca/svn/grad/colin/branches/TableTool_refactor@8774 57e6efec-57d4-0310-aeb1-a6c144bb1a8b
parent 7678fc53
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -8,6 +8,17 @@ classdef Cell < handle
    end
    
    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
+4 −3
Original line number Diff line number Diff line
@@ -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
+17 −22
Original line number Diff line number Diff line
@@ -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
+23 −23
Original line number Diff line number Diff line
@@ -11,9 +11,9 @@
% 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');
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);
@@ -28,14 +28,14 @@ for i = 1:size(grid.Cells,2)
            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);
            % 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);
            %set(grid.Cells(i).result,'TooltipString','');
            %grid.Cells(i).flag_cell(0);
        end
    end
    
end
end
+4 −7
Original line number Diff line number Diff line
@@ -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;
Loading