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

Fix random startup issues with the TET.

Sometimes when starting up, a previous handle would clash with an existing
handle, causing the TET to fail to load and locking Matlab into a state
where it can no longer exit.  Fix by ensuring on load no previous handle
is ever used, and instead just regenerate all of them.

git-svn-id: https://groke.mcmaster.ca/svn/grad/colin/trunk/TableTool@10858 57e6efec-57d4-0310-aeb1-a6c144bb1a8b
parent e3b00992
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2,8 +2,8 @@
%    function will call the draw methods for each of the 3 grids.
% inputs:
%   obj:GUI - current GUI object
%   load:boolean - 0 if grid is being refreshed, 1 if grid is being
%       loaded for the firs time.
%   load:tristate - 0 if grid is being refreshed, 1 if grid should reload
%                   data, 2 if the grid is being initialized.
% outputs:
%   none
% Author: Colin Eles elesc@mcmaster.ca
+5 −5
Original line number Diff line number Diff line
@@ -3,13 +3,13 @@
% inputs:
%   obj:GUI - current GUI object
%   grid:Grid - grid to be drawn, should be grid on left.
%   load:boolean - 0 if grid is being refreshed, 1 if grid is being
%       loaded for the firs time.
%   load:tristate - 0 if grid is being refreshed, 1 if grid should reload
%                   data, 2 if the grid is being initialized.
% outputs:
%   none
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function [] = draw_grid0(object,grid,load)
function [] = draw_grid0(object,grid,load, init)
% ensure that the results grid is up to date.
grid.refresh();
for i=1:size(grid.Cells,2)
@@ -22,12 +22,12 @@ for i=1:size(grid.Cells,2)
    pos(2) = pos2(2);
    pos(3) = pos1(3);
    pos(4) = pos2(4);
    if isempty(grid.Cells(i).result) || ~ishandle(grid.Cells(i).result)%load == 1
    if load == 2 || isempty(grid.Cells(i).result) || ~ishandle(grid.Cells(i).result)
        
        grid.Cells(i).result = object.create_std_text(object.fig,pos);
        % if we are loading the cell, try to restore the text
        % that was saved using save_results.
        if load == 1
        if load ~= 0
            set(grid.Cells(i).result,'String',grid.Cells(i).result_text);
        end
    else
+5 −5
Original line number Diff line number Diff line
@@ -4,8 +4,8 @@
% inputs:
%   obj:GUI - current GUI object
%   grid:Grid - grid to be drawn, should be grid on top.
%   load:boolean - 0 if grid is being refreshed, 1 if grid is being
%       loaded for the firs time.
%   load:tristate - 0 if grid is being refreshed, 1 if grid should reload
%                   data, 2 if the grid is being initialized.
% outputs:
%   none
% Author: Colin Eles elesc@mcmaster.ca
@@ -34,9 +34,9 @@ for i=1:size(grid.cells,2)
    pos(1) = pos(1) + (i-1)*grid.cells(i).condition_text_width + grid.cells(i).condition_text_offset + pb_space;
    % if the edit box does not exist create it, if it does
    % adjust it's position.
    if (isempty(grid.cells(i).cond) || ~ishandle(grid.cells(i).cond))%load == 1)
    if (load == 2 || isempty(grid.cells(i).cond) || ~ishandle(grid.cells(i).cond))
        grid.cells(i).cond = object.create_std_text(object.fig,pos);
        if (load == 1)
        if (load ~= 0)
            set(grid.cells(i).cond,'String',grid.cells(i).cond_text);
        end
    else
@@ -71,7 +71,7 @@ else
    delete(grid.delete_cell_pb)
    grid.delete_cell_pb = [];
end
if object.edit ==1 || load == 1
if object.edit ==1 || load ~= 0
    fig_pos = get(object.fig,'position');
    if(pos(1)+pos(3)>fig_pos(3))
        fig_pos(3) = pos(1)+pos(3);
+4 −4
Original line number Diff line number Diff line
@@ -3,8 +3,8 @@
% inputs:
%   obj:GUI - current GUI object
%   grid:Grid - grid to be drawn, should be grid on left.
%   load:boolean - 0 if grid is being refreshed, 1 if grid is being
%       loaded for the firs time.
%   load:tristate - 0 if grid is being refreshed, 1 if grid should reload
%                   data, 2 if the grid is being initialized.
% outputs:
%   none
% Author: Colin Eles elesc@mcmaster.ca
@@ -67,7 +67,7 @@ if (~isempty(grid))
        
        % if the edit box does not exist, ie. it is just being
        % created or we are loading the figure
        if (isempty(grid.cells(i).cond) || ~ishandle(grid.cells(i).cond))%load == 1)
        if (load == 2 || isempty(grid.cells(i).cond) || ~ishandle(grid.cells(i).cond))
            % create the new edit box
            grid.cells(i).cond = object.create_std_text(object.fig,pos);
            % if cell is the first in the grid use the new
@@ -82,7 +82,7 @@ if (~isempty(grid))
            % if we are loading the cell set the string of the
            % edit box to be the value that we saved as a
            % result of calling save_conditions
            if (load == 1)
            if (load ~= 0)
                set(grid.cells(i).cond,'String',grid.cells(i).cond_text);
            end
        else
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ uimenu(helpmenu,'Label','About Tabular Expression Toolbox','Callback',@(src,even

object.set_command_pos;
object.reset_wh();
object.draw_allgrids(1);
object.draw_allgrids(2);
object.saved = 1;
object.setPBenable;