Commit e91cb697 authored by Matthew Dawson's avatar Matthew Dawson
Browse files

Get row/columns working. Now just need sub grids on the right.

Things are making useful progress.


git-svn-id: https://groke.mcmaster.ca/svn/grad/colin/branches/TableTool_refactor@8735 57e6efec-57d4-0310-aeb1-a6c144bb1a8b
parent 19e64d77
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ classdef Data < handle
            object.outputs_grid = TableGrid();
        
            object.left_cond.addlistener('AddedOuterCell', @(src, event) left_grid_added_cell(object, src, event));
            object.left_cond.addlistener('RemovedOuterCell', @(src, event) object.outputs_grid.delete_row(event.changed_cell));
            object.top_cond.addlistener('AddedOuterCell', @(src, event) top_grid_added_cell(object, src, event));
            object.top_cond.addlistener('RemovedOuterCell', @(src, event) object.outputs_grid.delete_column(event.changed_cell));
        end
+5 −0
Original line number Diff line number Diff line
@@ -16,6 +16,11 @@ classdef GUIBase < handle
        function redraw(object)
            draw_onto(object, object.phandle);
        end
        
        function redraw_and_update_bb(object, src, event)
            object.redraw();
            object.notify('BoundingBoxChanged');
        end
    end
    
    methods(Abstract)
+13 −3
Original line number Diff line number Diff line
@@ -5,12 +5,22 @@ function draw_onto( object, parent_handle )
%   needs to be called everytime the back table is updated.  The class will
%   notify when its necessary.

    [~, y] = object.get_bounding_box();
    [x, y] = object.get_bounding_box();
    
    if size(object.controls, 2) ~= size(object.drawables, 2) || size(object.controls, 1) ~= size(object.drawables, 1)
        object.controls(size(object.drawables, 1), size(object.drawables, 2)) = 0;
    end

   for i = 1:size(object.drawables, 2)
        for j = 1:size(object.drawables, 1)
            if ~isempty( object.drawables{j, i} )
                p = uipanel('Parent', parent_handle, 'Units', 'pixels', 'Position', [sum(object.column_sizes(1:j-1))+(j-1)*20, y - sum(object.row_sizes(1:i)) - (i-1)*20, 1, 1]);
                if object.controls(j, i) == 0 || ~ishandle(object.controls(j, i))
                    p = uipanel('Parent', parent_handle, 'Units', 'pixels', 'Position', [sum(object.column_sizes(1:j-1))+(j-1)*20, y - sum(object.row_sizes(1:i)) - (i-1)*20, x, y]);
                    object.controls(j, i) = p;
                else
                    p = object.controls(j, i);
                    set(p, 'Position', [sum(object.column_sizes(1:j-1))+(j-1)*20, y - sum(object.row_sizes(1:i)) - (i-1)*20, x, y]);
                end
            object.drawables{j, i}.draw(p);
            end
        end
+10 −0
Original line number Diff line number Diff line
function delete_row( object, index )
%DELETE_COLUMN Deletes the requested column
%   Deletes the requested column from the table.

    object.grid(index, :) = [];
    object.height = object.height-1;
    
    notify(object, 'StructureChanged');
end
+4 −0
Original line number Diff line number Diff line
@@ -14,6 +14,10 @@ function draw_onto( object, parent_handle )
        object.controls(:, object.my_table_grid.width+1:size(object.controls, 2)) = [];
    end
    assert( ~(size(object.controls, 2) > object.my_table_grid.width), 'Implment delete when necessary.');
    if size(object.controls, 1) > object.my_table_grid.height
        delete(object.controls(object.my_table_grid.height+1:size(object.controls, 1), :));
        object.controls(object.my_table_grid.height+1:size(object.controls, 1), :) = [];
    end
    assert( ~(size(object.controls, 1) > object.my_table_grid.height), 'Implment delete when necessary.');

    if size(object.controls, 2) ~= object.my_table_grid.width || size(object.controls, 1) ~= object.my_table_grid.height
Loading