src/ldObject.cc

changeset 776
624131d0163d
parent 775
4661d6e83630
child 783
1db20d88650f
--- a/src/ldObject.cc	Sat May 17 20:33:27 2014 +0300
+++ b/src/ldObject.cc	Wed May 21 13:18:19 2014 +0300
@@ -560,6 +560,21 @@
 
 // =============================================================================
 //
+bool LDObject::previousIsInvertnext (LDBFCPtr& ptr)
+{
+	LDObjectPtr prev (previous());
+
+	if (prev != null && prev->type() == EBFC && prev.staticCast<LDBFC>()->statement() == LDBFC::InvertNext)
+	{
+		ptr = prev.staticCast<LDBFC>();
+		return true;
+	}
+
+	return false;
+}
+
+// =============================================================================
+//
 void LDObject::move (Vertex vect)
 {
 	if (hasMatrix())
@@ -851,6 +866,12 @@
 {
 	assert (document() != null);
 	document()->addToSelection (self());
+
+	// If this object is inverted with INVERTNEXT, pick the INVERTNEXT as well.
+	LDBFCPtr invertnext;
+
+	if (previousIsInvertnext (invertnext))
+		invertnext->select();
 }
 
 // =============================================================================
@@ -859,6 +880,12 @@
 {
 	assert (document() != null);
 	document()->removeFromSelection (self());
+
+	// If this object is inverted with INVERTNEXT, deselect the INVERTNEXT as well.
+	LDBFCPtr invertnext;
+
+	if (previousIsInvertnext (invertnext))
+		invertnext->deselect();
 }
 
 // =============================================================================

mercurial