[GRASS-SVN] r34467 - grass/trunk/gui/wxpython/vdigit
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Nov 24 00:57:13 EST 2008
Author: martinl
Date: 2008-11-24 00:57:13 -0500 (Mon, 24 Nov 2008)
New Revision: 34467
Modified:
grass/trunk/gui/wxpython/vdigit/digit.cpp
grass/trunk/gui/wxpython/vdigit/digit.h
grass/trunk/gui/wxpython/vdigit/undo.cpp
Log:
wxGUI/vdigit: some minor fixes in undo
(merge from devbr6, r34466)
Modified: grass/trunk/gui/wxpython/vdigit/digit.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/digit.cpp 2008-11-24 05:54:55 UTC (rev 34466)
+++ grass/trunk/gui/wxpython/vdigit/digit.cpp 2008-11-24 05:57:13 UTC (rev 34467)
@@ -32,7 +32,7 @@
InitCats();
}
- changesetCurrent = -1; // initial value for undo/redo
+ changesetEnd = changesetCurrent = -1; // initial value for undo/redo
display->msgCaption = _("Digitization error");
Modified: grass/trunk/gui/wxpython/vdigit/digit.h
===================================================================
--- grass/trunk/gui/wxpython/vdigit/digit.h 2008-11-24 05:54:55 UTC (rev 34466)
+++ grass/trunk/gui/wxpython/vdigit/digit.h 2008-11-24 05:57:13 UTC (rev 34467)
@@ -36,7 +36,8 @@
std::map<int, std::vector<action_meta> > changesets;
int changesetCurrent; /* first changeset to apply */
-
+ int changesetEnd; /* last changeset to be applied */
+
int AddActionToChangeset(int, action_type, int);
int ApplyChangeset(int, bool);
void FreeChangeset(int);
Modified: grass/trunk/gui/wxpython/vdigit/undo.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/undo.cpp 2008-11-24 05:54:55 UTC (rev 34466)
+++ grass/trunk/gui/wxpython/vdigit/undo.cpp 2008-11-24 05:57:13 UTC (rev 34467)
@@ -55,7 +55,7 @@
if (level < 0) { /* undo */
if (changesetCurrent + level < -1)
return changesetCurrent;
- for (int changeset = changesetCurrent; changeset >= changesetCurrent + level; --changeset) {
+ for (int changeset = changesetCurrent; changeset > changesetCurrent + level; --changeset) {
ApplyChangeset(changeset, true);
}
}
@@ -69,9 +69,14 @@
changesetCurrent += level;
- G_debug(2, "Digit.Undo(): changeset_current=%d",
- changesetCurrent);
-
+ G_debug(2, "Digit.Undo(): changeset_current=%d, changeset_last=%d, changeset_end=%d",
+ changesetCurrent, changesetLast, changesetEnd);
+
+ if (changesetCurrent == changesetEnd) {
+ changesetEnd = changesetLast;
+ return -1;
+ }
+
return changesetCurrent;
}
@@ -92,13 +97,16 @@
if (changeset < 0 || changeset > (int) changesets.size())
return -1;
+ if (changesetEnd < 0)
+ changesetEnd = changeset;
+
ret = 0;
std::vector<action_meta> action = changesets[changeset];
for (std::vector<action_meta>::const_reverse_iterator i = action.rbegin(), e = action.rend();
i != e; ++i) {
type = (*i).type;
line = (*i).line;
-
+
if ((undo && type == ADD) ||
(!undo && type == DEL)) {
if (Vect_line_alive(display->mapInfo, line)) {
More information about the grass-commit
mailing list