Commit 1199bc61 authored by Colin Eles's avatar Colin Eles
Browse files

user can now change output datatype and code will convert to appropriate type,...

user can now change output datatype and code will convert to appropriate type, need to test this with hdl, etc.

git-svn-id: https://groke.mcmaster.ca/svn/grad/colin/trunk/TableTool@5861 57e6efec-57d4-0310-aeb1-a6c144bb1a8b
parent 6125d2eb
Loading
Loading
Loading
Loading
+30 −7
Original line number Diff line number Diff line
@@ -249,6 +249,16 @@ classdef GUI < handle
            obj.Data.fig = obj.fig;
            
            
        end
        
        
        function [] = set_block_display(object)
            if obj.pvs_checked == 1
            
            
            end
            
            
        end
        
        function [] = update_Statusbar(object)
@@ -409,6 +419,18 @@ classdef GUI < handle
            
        end
        
        function type = output_data_type(object)
            S = sfroot;
            code_block = sprintf('%s/code',getfullname(object.block_handle));
            myState = S.find('-isa','Stateflow.EMChart', '-and', 'Path', code_block); % find which one we want to edit
            if strncmp(myState.Outputs.DataType,'Inherit',7);
                type = ''
            else
                type = myState.Outputs.DataType;
            end
        
        end
        
        %% save_call
        %    callback function that is called whenever the save button is
        %    pressed. This function will generate code and store it in the
@@ -422,6 +444,7 @@ classdef GUI < handle
        % outputs;
        %   none
        function eml_handle = save_call(object,src,event)
            
            if object.mode == 0
                model = gcs;
                %make sure we are not looking at the library model
@@ -465,7 +488,7 @@ classdef GUI < handle
                % temporary solution is just to use one of the outputs from our
                % table, we will use the first cell because it is guaranteed to
                % be filled in, regardless of the dimensionality of the table.
                code = [code sprintf('output=%s;\n',get(object.Grid0.Cells(1).result,'String'))];
                code = [code sprintf('output=%s(%s);\n',object.output_data_type,get(object.Grid0.Cells(1).result,'String'))];
                code = [code object.generate_code(object.Grid1,object.Grid2,0)];
                fprintf('%s',code);

@@ -937,7 +960,7 @@ classdef GUI < handle
                        for k=1:depth
                            space = [space sprintf('  ')];
                        end
                        code = [code sprintf('%soutput = %s;\n',space,strtrim(char(get(cell.result,'String'))))];
                        code = [code sprintf('%soutput = %s(%s);\n',space,obj.output_data_type,strtrim(char(get(cell.result,'String'))))];
                        depth = depth - 1;
                        space = [];
                        for k=1:depth
@@ -968,7 +991,7 @@ classdef GUI < handle
                        for k=1:depth
                            space = [space sprintf('  ')];
                        end
                        code = [code sprintf('%soutput = %s;\n',space,strtrim(char(get(cell.result,'String'))))];
                        code = [code sprintf('%soutput = %s(%s);\n',space,obj.output_data_type,strtrim(char(get(cell.result,'String'))))];
                        depth = depth - 1;
                        space = [];
                        for k=1:depth
@@ -1045,7 +1068,7 @@ classdef GUI < handle
                                    for k=1:depth
                                        space = [space sprintf('  ')];
                                    end
                                    code = [code sprintf('%soutput = %s;\n',space,strtrim(char(get(cell.result,'String'))))];
                                    code = [code sprintf('%soutput = %s(%s);\n',space,obj.output_data_type,strtrim(char(get(cell.result,'String'))))];
                                    depth = depth - 1;
                                    space = [];
                                    for k=1:depth
@@ -1079,7 +1102,7 @@ classdef GUI < handle
                                        for k=1:depth
                                            space = [space sprintf('  ')];
                                        end
                                        code = [code sprintf('%soutput = %s;\n',space,strtrim(char(get(cell.result,'String'))))];
                                        code = [code sprintf('%soutput = %s(%s);\n',space,obj.output_data_type,strtrim(char(get(cell.result,'String'))))];
                                        depth = depth - 1;
                                        space = [];
                                        for k=1:depth
@@ -1148,7 +1171,7 @@ classdef GUI < handle
                                    for k=1:depth
                                        space = [space sprintf('  ')];
                                    end
                                    code = [code sprintf('%soutput = %s;\n',space,strtrim(char(get(cell.result,'String'))))]
                                    code = [code sprintf('%soutput = %s(%s);\n',space,obj.output_data_type,strtrim(char(get(cell.result,'String'))))]
                                    depth = depth - 1;
                                    space = [];
                                    for k=1:depth
@@ -1182,7 +1205,7 @@ classdef GUI < handle
                                        for k=1:depth
                                            space = [space sprintf('  ')];
                                        end
                                        code = [code sprintf('%soutput = %s;\n',space,strtrim(char(get(cell.result,'String'))))];
                                        code = [code sprintf('%soutput = %s(%s);\n',space,obj.output_data_type,strtrim(char(get(cell.result,'String'))))];
                                        depth = depth - 1;
                                        space = [];
                                        for k=1:depth