Commit 374f7593 authored by Colin Eles's avatar Colin Eles
Browse files

undo/redo working better now, still a little bugg

y

git-svn-id: https://groke.mcmaster.ca/svn/grad/colin/trunk/TableTool@6209 57e6efec-57d4-0310-aeb1-a6c144bb1a8b
parent 99222c5c
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -28,6 +28,9 @@
                gui.undo_man.new_state(undo_data);
             end
            
             gui.update_undoredo

            
        end
        
        
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -61,7 +61,8 @@ classdef GUI < handle
        multi_opt_out = [];
        version = '0.1';
        undo_man = [];
        
        undo_opt = [];
        redo_opt = [];
    end
    
    methods
+9 −6
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@
                'FontWeight','bold',...
                'FontSize',12,...
                'Max',2.0,...
                'KeyPressFcn',@(src,event)textbox_callback(object,src,event),...
                'BackgroundColor',[1 1 1]);
            
            % input list label
@@ -119,6 +120,7 @@
                'FontWeight','bold',...
                'Max',2.0,...
                'FontSize',12,...
                'KeyPressFcn',@(src,event)textbox_callback(object,src,event),...
                'BackgroundColor',[1 1 1]);
            
            %object.multi_grp = uibuttongroup(...
@@ -163,8 +165,8 @@
            uimenu(filemenu,'Label','Save to Block','Separator','on','Accelerator','s','Callback',@(src,event)save_call(object,src,event));
            uimenu(filemenu,'Label','Save to M-File','Callback',@(src,event)save_ext_call(object,src,event));
            uimenu(filemenu,'Label','Close','Accelerator','w','Separator','on','Callback',@(src,event)close_fig(object,src,event));     
            uimenu(editmenu,'Label','Undo','Accelerator','z','Callback',@(src,event)undo_call(object,src,event));
            uimenu(editmenu,'Label','Redo','Accelerator','r','Callback',@(src,event)redo_call(object,src,event));
            object.undo_opt = uimenu(editmenu,'Label','Undo','Accelerator','z','Callback',@(src,event)undo_call(object,src,event));
            object.redo_opt = uimenu(editmenu,'Label','Redo','Accelerator','r','Callback',@(src,event)redo_call(object,src,event));
            uimenu(editmenu,'Label','Show edit controls','Checked','on','Separator','on');
            uimenu(editmenu,'Label','Ports and Data Manager','Accelerator','p','Callback',@(src,event)input_call(object,src,event));
            multi_mode_menu = uimenu(editmenu,'Label','Output Mode');
@@ -193,17 +195,17 @@
                
            end
            
                        object.undo_man = UndoManager();

            
            
            object.update_Statusbar;
            object.update_multi_check_status;
            
                        object.update_undoredo;

            object.PVS = PVS_checker(object.Data);
            object.EMLGen = EMLGenerator(object.Data);
            
            object.undo_man = UndoManager();
            
            
            object.initialized = 1;
@@ -212,6 +214,7 @@
            
            
            
            
        end
        
        
+2 −1
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
                
            %end
           
            object.update_undoredo


            

@GUI/update_undoredo.m

0 → 100644
+20 −0
Original line number Diff line number Diff line
function [ ] = update_undoredo( object )
% updates the menu options so that they are either enabled or disabled

if (object.undo_man.undo_level == 0)
    set(object.redo_opt,'Enable','off');
else
    set(object.redo_opt,'Enable','on');
end

if (object.undo_man.current_depth == 0)
    set(object.undo_opt,'Enable','off');
else
        set(object.undo_opt,'Enable','on');
end

    


end
Loading