Index: guitools/PlotPanel.py
===================================================================
--- guitools/PlotPanel.py	(revision ac9c4656b3129056876f5d8d175ebb478736cd74)
+++ guitools/PlotPanel.py	(revision ad8bcd6945b6f5a975704dfa5d1fb0894ccc99b2)
@@ -13,7 +13,4 @@
 from pylab import  gca, gcf
 from plottables import Theory1D
-
-#from matplotlib.backend_bases import MouseEvent
-#from plottables import Data1D
 #TODO: make the plottables interactive
 
@@ -92,13 +89,6 @@
                 lo=loprev
                 hi=hiprev
-                #print "Not possible to scale"
-           
             else:
                 lo,hi = math.pow(10.,lo),math.pow(10.,hi)
-                #assert lo >0,"lo = %g"%lo
-                #print "possible to scale"
-           
-            #print "these are low and high",lo,hi
-
         return (lo,hi)
 
@@ -158,7 +148,6 @@
         self.mousemotion=False
         
-        #self.canvas.Bind(wx.EVT_MOUSE_EVENTS,self.onTest)
         self.axes = [self.subplot]
-         # new data for the fit 
+        # new data for the fit 
         self.fit_result = Theory1D(x=[], y=[], dy=None)
         #self.fit_result = Data1D(x=[], y=[],dx=None, dy=None)
@@ -174,16 +163,21 @@
         self.ErrBvalue=None
         self.Chivalue=None
+        
+        # Dragging info
         self.begDrag=False
-        #self.begDragI=False
         self.xInit=None
         self.yInit=None
         self.xFinal=None
         self.yFinal=None
-  
+        
+        # Default locations
+        self._default_save_location = os.getcwd()        
+        
+        
     def onLeftDown(self,event): 
         """ left button down and ready to drag"""
         self.leftdown=True
         ax = event.inaxes
-        if ax !=None:
+        if ax != None:
             self.xInit,self.yInit=event.xdata,event.ydata
             
@@ -208,4 +202,9 @@
                 self.xFinal,self.yFinal=event.xdata,event.ydata
                 
+                # Check whether this is the first point
+                if self.xInit==None:
+                    self.xInit = self.xFinal
+                    self.yInit = self.yFinal
+                    
                 xdelta = self.xFinal -self.xInit
                 ydelta = self.yFinal -self.yInit
@@ -450,9 +449,8 @@
         #print "Save image not implemented"
         path = None
-        dlg = wx.FileDialog(self, "Choose a file", os.getcwd(), "", "*.png", wx.SAVE)
+        dlg = wx.FileDialog(self, "Choose a file", self._default_save_location, "", "*.png", wx.SAVE)
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()
-            mypath = os.path.basename(path)
-            print path
+            self._default_save_location = os.path.dirname(path)
         dlg.Destroy()
         if not path == None:
@@ -654,5 +652,5 @@
                 
             if (self.xLabel=="log10(x)" ):
-                item.transformX(transform.toX,transform.errToX)
+                item.transformX(transform.toX_pos,transform.errToX_pos)
                 self.set_xscale("log")
                 name, units = item.get_xaxis() 
@@ -664,5 +662,5 @@
                 self.set_yscale("linear")
                 name, units = item.get_yaxis()
-                self.graph.yaxis("log\ \ %s" % name,  "%s" % units)
+                self.graph.yaxis("\log\ \ %s" % name,  "%s" % units)
                 
                 
@@ -675,5 +673,5 @@
                 
             if ( self.yLabel=="log10(y)" ): 
-                item.transformY(transform.toX,transform.errToX)
+                item.transformY(transform.toX_pos,transform.errToX_pos)
                 self.set_yscale("log")  
                 name, units = item.get_yaxis()
@@ -708,5 +706,5 @@
                 yname, yunits = item.get_yaxis()
                 xname, xunits = item.get_xaxis()
-                self.graph.yaxis("log\ (%s \ \ %s)" % (yname,xname),  "%s%s" % (yunits,xunits))
+                self.graph.yaxis("\log\ (%s \ \ %s)" % (yname,xname),  "%s%s" % (yunits,xunits))
                
                 
@@ -717,5 +715,5 @@
                 xname, xunits = item.get_xaxis() 
                 xunits = convertUnit(2,xunits) 
-                self.graph.yaxis("Log (%s \ \ %s^{2})" % (yname,xname),  "%s%s" % (yunits,xunits))
+                self.graph.yaxis("\log (%s \ \ %s^{2})" % (yname,xname),  "%s%s" % (yunits,xunits))
                 
             
@@ -726,5 +724,5 @@
                 xname, xunits = item.get_xaxis()
                 xunits = convertUnit(4,xunits) 
-                self.graph.yaxis("Log (%s \ \ %s^{4})" % (yname,xname),  "%s%s" % (yunits,xunits))
+                self.graph.yaxis("\log (%s \ \ %s^{4})" % (yname,xname),  "%s%s" % (yunits,xunits))
                 
             if ( self.viewModel == "Guinier lny vs x^(2)"):
@@ -740,5 +738,5 @@
                 self.set_yscale("linear")
                 name, units = item.get_yaxis()
-                self.graph.yaxis("$Log %s$" % name,  "%s" % units)
+                self.graph.yaxis("\log\ \ %s" % name,  "%s" % units)
                
                 
Index: guitools/fitDialog.py
===================================================================
--- guitools/fitDialog.py	(revision 052a66bcbb3220025ecb5afe3a9b2afadcc6f3c2)
+++ guitools/fitDialog.py	(revision ad8bcd6945b6f5a975704dfa5d1fb0894ccc99b2)
@@ -285,4 +285,7 @@
               
                 #Find the fitting parameters
+                # Always use the same defaults, so that fit history doesn't play a role! 
+                self.cstA = fittings.Parameter(self.model, 'A', self.default_A)
+                self.cstB  = fittings.Parameter(self.model, 'B', self.default_B)
                 
                 if (self.xLabel.lower() == "log10(x)"):
Index: guitools/transform.py
===================================================================
--- guitools/transform.py	(revision 05da1f8994b512c6a943f61974e1f83b0508cfab)
+++ guitools/transform.py	(revision ad8bcd6945b6f5a975704dfa5d1fb0894ccc99b2)
@@ -8,4 +8,15 @@
     """
     return x
+
+def toX_pos(x,y=None):
+    """
+    This function is used to load value on Plottable.View
+    @param x: Float value
+    @return x,
+    """
+    if not x>0:
+        raise ValueError, "Transformation only accepts positive values."
+    else:
+        return x
 
 def toX2(x,y=None):
@@ -35,5 +46,5 @@
     """
     if not x > 0:
-        raise ValueError, "Log(X)of a negative value "
+        raise ValueError, "Log(x)of a negative value "
     else:
         return math.log(x)
@@ -86,4 +97,20 @@
     if dx==None:
         dx=0
+    return dx
+
+def errToX_pos(x,y=None,dx=None,dy=None):
+    """
+        calculate error of x**2
+        @param x: float value
+        @param dx: float value
+    """
+    if dx==None:
+        dx=0
+        
+    # Check that the point on the graph is positive
+    # within errors
+    if not x-dx > 0:
+        raise ValueError, "Transformation does not accept point that are consistent with zero."
+    
     return dx
 
@@ -124,4 +151,10 @@
     if dx==None:
         dx = 0
+        
+    # Check that the point on the graph is positive
+    # within errors
+    if not x-dx > 0:
+        raise ValueError, "Transformation does not accept point that are consistent with zero."
+        
     if x!=0:
         dx = dx/(x*math.log(10))
@@ -139,4 +172,10 @@
     if dx==None:
         dx = 0
+            
+    # Check that the point on the graph is positive
+    # within errors
+    if not x-dx > 0:
+        raise ValueError, "Transformation does not accept point that are consistent with zero."
+
     if x!=0:
         dx = dx/x
@@ -160,4 +199,9 @@
         calculate error of Log(xy)
     """
+    # Check that the point on the graph is positive
+    # within errors
+    if (not x-dx > 0) or (not y-dy > 0):
+        raise ValueError, "Transformation does not accept point that are consistent with zero."
+    
     if (x!=0) and (y!=0):
         if dx == None:
@@ -175,4 +219,9 @@
         calculate error of Log(yx**2)
     """
+    # Check that the point on the graph is positive
+    # within errors
+    if (not x-dx > 0) or (not y-dy > 0):
+        raise ValueError, "Transformation does not accept point that are consistent with zero."
+    
     if (x > 0) and (y > 0):
         if (dx == None):
@@ -217,4 +266,9 @@
         @param x: float value
     """
+    # Check that the point on the graph is positive
+    # within errors
+    if (not x-dx > 0) or (not y-dy > 0):
+        raise ValueError, "Transformation does not accept point that are consistent with zero."
+    
     if dx==None:
         dx=0
