Index: invariantview/perspectives/invariant/invariant.py
===================================================================
--- invariantview/perspectives/invariant/invariant.py	(revision 35f2f49584f290b2a8597bc7fa3b6f9f27c5d3f9)
+++ invariantview/perspectives/invariant/invariant.py	(revision 27f3831d873b892f6463e9312426563f00511d5d)
@@ -291,5 +291,4 @@
         
         
-        
     def plot_theory(self, data=None, name=None):
         """
Index: invariantview/perspectives/invariant/invariant_panel.py
===================================================================
--- invariantview/perspectives/invariant/invariant_panel.py	(revision 35f2f49584f290b2a8597bc7fa3b6f9f27c5d3f9)
+++ invariantview/perspectives/invariant/invariant_panel.py	(revision 27f3831d873b892f6463e9312426563f00511d5d)
@@ -65,5 +65,5 @@
         kwds["style"] = wx.FULL_REPAINT_ON_RESIZE
         ScrolledPanel.__init__(self, parent=parent, *args, **kwds)
-        PanelBase.__init__(self)
+        PanelBase.__init__(self, parent)
         self.SetupScrolling()
         #Font size 
@@ -197,6 +197,8 @@
             if num > 0 :
                 self._undo_enable()
+                self._set_undo_flag(True)
             if num < len(state.state_list) - 1:
                 self._redo_enable()
+                self._set_redo_flag(True)
                 
             # get bookmarks
@@ -524,4 +526,5 @@
             self._set_compute_state(state='compute')
             self.button_bookmark.Enable(True)
+            self._set_bookmark_flag(True)
             msg= "\n\nStarting a new invariant computation..."            
             wx.PostEvent(self.parent, StatusEvent(status=msg))
@@ -627,11 +630,12 @@
             if not self.button_report.IsEnabled():
                 self.button_report.Enable(True)
+                self._set_preview_flag(True)
             if not self.button_save.IsEnabled():
                 self.button_save.Enable(True)
+                self._set_save_flag(True)
             wx.PostEvent(self.parent,
                 StatusEvent(status='\nFinished invariant computation...'))
-           
-
-    def undo(self,event=None):
+            
+    def on_undo(self,event=None):
         """
         Go back to the previous state
@@ -650,13 +654,16 @@
         if float(pre_state_num) <= 0:
             self._undo_disable()
+            self._set_undo_flag(False)
         else:
             self._undo_enable()
+            self._set_undo_flag(True)
 
         self._redo_enable()
+        self._set_redo_flag(True)
         self.is_power_out = False  
         self._info_state_num()
         
         
-    def redo(self,event=None):
+    def on_redo(self,event=None):
         """
         Go forward to the previous state
@@ -674,12 +681,15 @@
         if float(next_state_num)+2 > len(self.state.state_list):
             self._redo_disable()
+            self._set_redo_flag(False)
         else:
             self._redo_enable()
+            self._set_redo_flag(FTrue)
         
         self._undo_enable()
+        self._set_undo_flag(True)
         self.is_power_out = False
         self._info_state_num()
         
-    def report(self, event=None):
+    def on_preview(self, event=None):
         """
         Invoke report dialog panel
@@ -821,8 +831,13 @@
         self._reset_output()
         self.button_undo.Disable()
+        self._set_undo_flag(False)
         self.button_redo.Disable()
+        self._set_redo_flag(False)
         self.button_bookmark.Disable()
+        self._set_bookmark_flag(False)
         self.button_report.Disable()
+        self._set_preview_flag(False)
         self.button_save.Disable() 
+        self._set_save_flag(False)
         self.button_calculate.SetFocus()
         #self.SetupScrolling()
@@ -872,5 +887,7 @@
         event.Skip()
         self._undo_enable()
+        self._set_undo_flag(True)
         self._redo_disable()
+        self._set_redo_flag(False)
             
     def _set_compute_state(self,state=None):
@@ -914,6 +931,7 @@
         # Enable the undo button if it was not
         self._undo_enable()
+        self._set_undo_flag(True)
         self._redo_disable()
-        
+        self._set_redo_flag(False)
         
     def _reset_state_list(self, data=None):
@@ -994,7 +1012,11 @@
         event.Skip()
         self._undo_enable()
+        self._set_undo_flag(True)
         self._redo_disable()
+        self._set_redo_flag(False)
         self.button_bookmark.Enable(True)
+        self._set_bookmark_flag(True)
         self.button_report.Disable()
+        self._set_preview_flag(False)
        
         
@@ -1041,9 +1063,9 @@
         self.popUpMenu.AppendItem(self._bmark)
         self._bmark.Enable(True)
-        wx.EVT_MENU(self, id, self._on_bookmark)
+        wx.EVT_MENU(self, id, self.on_bookmark)
         self.popUpMenu.AppendSeparator()
         self.Bind(wx.EVT_CONTEXT_MENU, self._on_context_menu)
         
-    def _on_bookmark(self,event):
+    def on_bookmark(self,event):
         """
         Save the panel state in memory and add the list on
@@ -1101,4 +1123,5 @@
         self.state.state_num = state_num
         self._undo_enable()
+        self._set_undo_flag(True)
         self._info_bookmark_num(event)
         
@@ -1136,5 +1159,5 @@
         date= str( month)+"/"+str(day)+"/"+str(year)
         return my_time, date
-    
+      
     def _undo_enable(self):
         """
@@ -1165,5 +1188,5 @@
             self.button_redo.Disable()
             
-    def _on_save_button(self, evt=None): 
+    def on_save(self, evt=None): 
         """
         Save invariant state into a file
@@ -1371,5 +1394,7 @@
         if event != None: 
             self.button_bookmark.Enable(True)
+            self._set_bookmark_flag(True)
             self.button_report.Disable()
+            self._set_preview_flag(False)
             print "enable fit==>event!=None"
 
@@ -1390,5 +1415,7 @@
         if event != None: 
             self.button_bookmark.Enable(True)
+            self._set_bookmark_flag(True)
             self.button_report.Disable()
+            self._set_preview_flag(False)
             
         if self.enable_low_cbox.GetValue():
@@ -1417,5 +1444,7 @@
         if event != None: 
             self.button_bookmark.Enable(True)
+            self._set_bookmark_flag(True)
             self.button_report.Disable()
+            self._set_preview_flag(False)
         if self.guinier.GetValue():
             self.power_law_low.SetValue(False)
@@ -1518,5 +1547,7 @@
         if event != None: 
             self.button_bookmark.Enable(True)
+            self._set_bookmark_flag(True)
             self.button_report.Disable()
+            self._set_preview_flag(False)
         if self.fix_enable_high.IsEnabled():
             if self.fix_enable_high.GetValue():
@@ -1534,5 +1565,7 @@
         if event != None: 
             self.button_bookmark.Enable(True)
+            self._set_bookmark_flag(True)
             self.button_report.Disable()
+            self._set_preview_flag(False)
         if self.enable_high_cbox.GetValue():
             self.npts_high_tcl.Enable()
@@ -1828,5 +1861,5 @@
         
         #self.button_undo.SetBackgroundColour('#c2e6f8')
-        self.Bind(wx.EVT_BUTTON, self.undo, id=id)
+        self.Bind(wx.EVT_BUTTON, self.on_undo, id=id)
         self._undo_disable()
         #redo button
@@ -1835,6 +1868,7 @@
         self.button_redo = wx.BitmapButton(self, id,wx.Bitmap(self.redo_png))
         self.button_redo.SetToolTipString("Redo")
-        self.Bind(wx.EVT_BUTTON, self.redo, id=id)
+        self.Bind(wx.EVT_BUTTON, self.on_redo, id=id)
         self._redo_disable()   
+        self._set_redo_flag(False)
         #bookmark button
         id = wx.NewId()
@@ -1844,5 +1878,5 @@
         hint_msg = "Bookmark: right-click on the panel to retrieve it"
         self.button_bookmark.SetToolTipString(hint_msg)
-        self.Bind(wx.EVT_BUTTON, self._on_bookmark, id=id)
+        self.Bind(wx.EVT_BUTTON, self.on_bookmark, id=id)
         #report button
         id = wx.NewId()
@@ -1852,6 +1886,7 @@
         hint_msg = "Report the result of the computation"
         self.button_report.SetToolTipString(hint_msg)
-        self.Bind(wx.EVT_BUTTON, self.report, id=id)
+        self.Bind(wx.EVT_BUTTON, self.on_preview, id=id)
         #self.button_report.Disable()   
+        #self._set_preview_flag(False)   
         #save button
         id = wx.NewId()
@@ -1860,6 +1895,7 @@
                                            name='Save_invariant')
         self.button_save.SetToolTipString("Save as a file")
-        self.Bind(wx.EVT_BUTTON, self._on_save_button, id=id)   
+        self.Bind(wx.EVT_BUTTON, self.on_save, id=id)   
         self.button_save.Disable()  
+        self._set_save_flag(False)
         self.save_button_sizer.AddMany([((PANEL_WIDTH/2,20), 1 ,
                                          wx.EXPAND|wx.ADJUST_MINSIZE,0),
