Sfoglia il codice sorgente

wxGUI/vdigit: fix undo tool (changesets start at 0)
(merge https://trac.osgeo.org/grass/changeset/41576 from relbr64)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@41578 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 15 anni fa
parent
commit
a1d53294df

+ 2 - 2
gui/wxpython/gui_modules/toolbars.py

@@ -1166,7 +1166,7 @@ class VDigitToolbar(AbstractToolbar):
         if self.mapLayer:
             Debug.msg (4, "VDigitToolbar.StopEditing(): layer=%s" % self.mapLayer.GetName())
             if UserSettings.Get(group='vdigit', key='saveOnExit', subkey='enabled') is False:
-                if self.parent.digit.GetUndoLevel() > 0:
+                if self.parent.digit.GetUndoLevel() > -1:
                     dlg = wx.MessageDialog(parent=self.parent,
                                            message=_("Do you want to save changes "
                                                      "in vector map <%s>?") % self.mapLayer.GetName(),
@@ -1176,7 +1176,7 @@ class VDigitToolbar(AbstractToolbar):
                         # revert changes
                         self.parent.digit.Undo(0)
                     dlg.Destroy()
-        
+            
             self.parent.statusbar.SetStatusText(_("Please wait, "
                                                   "closing and rebuilding topology of "
                                                   "vector map <%s>...") % self.mapLayer.GetName(),

+ 8 - 7
gui/wxpython/gui_modules/vdigit.py

@@ -3,7 +3,7 @@
 
 @brief Vector digitizer extension
 
-Import:
+Usage:
 
 @code
   from vdigit import VDigit as VDigit
@@ -20,11 +20,9 @@ Classes:
  - VDigitDuplicatesDialog
  - VDigitVBuildDialog
 
-(C) 2007-2009 by the GRASS Development Team
-
-This program is free software under the GNU General Public
-License (>=v2). Read the file COPYING that comes with GRASS
-for details.
+(C) 2007-2010 by the GRASS Development Team
+This program is free software under the GNU General Public License
+(>=v2). Read the file COPYING that comes with GRASS for details.
 
 @author Martin Landa <landa.martin gmail.com>
 """
@@ -705,7 +703,10 @@ class VDigit(AbstractDigit):
             self.toolbar.EnableUndo(False)
 
     def GetUndoLevel(self):
-        """!Get undo level (number of active changesets)"""
+        """!Get undo level (number of active changesets)
+        
+        Note: Changesets starts wiht 0
+        """
         if not self.digit:
             return -1
         

+ 2 - 2
gui/wxpython/vdigit/undo.cpp

@@ -7,7 +7,7 @@
    License (>=v2). Read the file COPYING that comes with GRASS
    for details.
 
-   (C) 2008-2009 by Martin Landa, and the GRASS development team
+   (C) 2008-2010 by Martin Landa, and the GRASS development team
 
    \author Martin Landa <landa.martin gmail.com>
 */
@@ -44,7 +44,7 @@ int Digit::Undo(int level)
 
     if (level == 0) {
 	/* 0 -> undo all */
-	level = -changesetLast;
+	level = -(changesetLast + 1);
     }
 
     G_debug(2, "Digit.Undo(): changeset_last=%d, changeset_current=%d, level=%d",