src/gui_editactions.cpp

changeset 262
56f8987f4c7c
parent 254
434c9844e45d
child 265
955c0aabfebf
--- a/src/gui_editactions.cpp	Mon May 27 18:17:21 2013 +0300
+++ b/src/gui_editactions.cpp	Mon May 27 22:05:10 2013 +0300
@@ -681,7 +681,7 @@
 	runIsecalc ();
 }
 
-// =========================================================================================================================================
+// =============================================================================
 MAKE_ACTION (replaceCoords, "Replace Coordinates", "replace-coords", "Find and replace coordinate values", CTRL (R)) {
 	ReplaceCoordsDialog dlg;
 	
@@ -690,8 +690,10 @@
 	
 	const double search = dlg.searchValue (),
 		replacement = dlg.replacementValue ();
+	const bool any = dlg.any (),
+		rel = dlg.rel ();
+	
 	vector<int> sel = dlg.axes ();
-	
 	EditHistory* history = new EditHistory;
 	
 	for (LDObject* obj : g_win->sel ()) {
@@ -701,8 +703,12 @@
 		for (int ax : sel) {
 			double& coord = obj->coords[i][(Axis) ax];
 			
-			if (coord == search)
-				coord = replacement;
+			if (any || coord == search) {
+				if (!rel)
+					coord = 0;
+				
+				coord += replacement;
+			}
 		}
 		
 		history->addEntry (copy, obj, obj->getIndex (g_curfile));

mercurial