Commit a9572dc0 authored by Colin Eles's avatar Colin Eles
Browse files

preparing code for release, cleaning and commenting

git-svn-id: https://groke.mcmaster.ca/svn/grad/colin/trunk/TableTool@6227 57e6efec-57d4-0310-aeb1-a6c144bb1a8b
parent d392fb7f
Loading
Loading
Loading
Loading
+19 −28
Original line number Diff line number Diff line
%% delete_recursive
        % delete any lines that are unconnected and one end or both
        % code from
        % http://www.mathworks.com/matlabcentral/fileexchange/12352-delete-unconnected-lines
        % Copyright (c) 2009, Per-Anders Ekström
            function delete_recursive( line )
            %DELETE_RECURSIVE( LINE )  Delete line if:
            %   1) do not have any source-block
            %   2) do not have any line-children AND no destination-block
            %   otherwise go recursively through all eventual line-children
function delete_recursive( line_handle )

                if get( line, 'SrcPortHandle' ) < 0
                    delete_line( line ) ;
if get( line_handle, 'SrcPortHandle' ) < 0
    delete_line( line_handle ) ;
    return
end
                LineChildren = get( line, 'LineChildren' ) ;
                if isempty( LineChildren )
                    if get( line, 'DstPortHandle' ) < 0
                        delete_line( line ) ;
LineChild = get( line_handle, 'LineChildren' ) ;
if ~isempty( LineChild )
    for i=1:length( LineChild )
        obj.delete_recursive( LineChild( i ) )
    end
else
                    for i=1:length( LineChildren )
                        obj.delete_recursive( LineChildren( i ) )
    if get( line_handle, 'DstPortHandle' ) < 0
        delete_line( line_handle ) ;
    end
end
end
        % end copyright

+32 −30
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@
%   checked:boolean - 0 if not typechecked, 1 if typechecked
% outputs:
%   none
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function [] = set_block_display(block_handle,checked)
%if object.pvs_checked == 1
mask_string = [];
+188 −196
Original line number Diff line number Diff line
@@ -9,6 +9,8 @@
% outputs:
%   eml_handle:handle - handle of eml block, as this function may
%   create a new block.
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function eml_handle = set_code(block_handle,code,function_name)
% unlink the block from the library, this is necessary if
% we
@@ -52,22 +54,18 @@

% delete any lines that are unconnected and one end or both
% code from
                % http://www.mathworks.com/matlabcentral/fileexchange/12352-delete-unconnected-lines
                % Copyright (c) 2009, Per-Anders Ekström
                    % delete all the lines
lines = find_system( getfullname(block_handle), ...
    'LookUnderMasks', 'all', ...
    'FindAll', 'on', ...
    'Type', 'line' ) ;


                    % for each line, call delete_recursive if handle still exist
for i=1:length( lines )
    if ishandle( lines( i ) )
        TableBlock.delete_recursive( lines( i ) )
    end
end
                % end copyright


% we need to determine which of the inports and outports we
% need to create and delete. Whenever we delete a port anything
@@ -176,21 +174,15 @@

% delete any lines that are unconnected and one end or both
% again sometimes extra lines are created
                % code from
                % http://www.mathworks.com/matlabcentral/fileexchange/12352-delete-unconnected-lines
                % Copyright (c) 2009, Per-Anders Ekström
                    % delete all the lines 
lines = find_system( getfullname(block_handle), ...
    'LookUnderMasks', 'all', ...
    'FindAll', 'on', ...
    'Type', 'line' ) ;

                    % for each line, call delete_recursive if handle still exist
for i=1:length( lines )
    if ishandle( lines( i ) )
        TableBlock.delete_recursive( lines( i ) )
    end
end
                % end copyright

end
 No newline at end of file
+16 −15
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@
%   edit:boolean - 0 when not in edit mode, 1 in edit mode
% outputs;
%   h:double - height in number of cells
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function h = cal_height(object,edit)
h = 0;
if (isempty(object.subgrid))
@@ -23,4 +25,3 @@ function h = cal_height(object,edit)
    
end
end
       
 No newline at end of file
+29 −28
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@
%   object:Cell - Current Cell Object
% outputs;
%   none
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function [] = delete_Cell(object)
if(isempty(object.subgrid))
    delete(object.grid_pb);
@@ -25,4 +27,3 @@
end
end
        
 No newline at end of file
Loading