[don't edit when outside the grid when the mouse is released
Andreas Röver <roever@users.sourceforge.net>**20060102130302] {
hunk ./src/gui/SquareEditor.cpp 25
+static int floordiv(int a, int b) {
+  if (a > 0)
+    return a/b;
+  else
+    return (a-b+1)/b;
+}
+
hunk ./src/gui/SquareEditor.cpp 320
-      if (setLayer(space->getZ()-currentZ-1)) {
+      int s, tx, ty;
+      calcParameters(&s, &tx, &ty);
+
+      int x = Fl::event_x() - tx;
+      int y = Fl::event_y() - ty;
+
+      x = floordiv(x, s);
+      y = floordiv(y, s);
+
+      y = space->getY() - y - 1;
+
+      // check, if the current position is inside the grid, only if so carry out action
+      if (0 <= x && x < space->getX() && 0 <= y && y < space->getY() && setLayer(space->getZ()-currentZ-1)) {
hunk ./src/gui/SquareEditor.cpp 358
-      x /= s;
-      y /= s;
+      x = floordiv(x, s);
+      y = floordiv(y, s);
}
