Example #1
0
// _Select
void
PathManipulator::_Select(BRect r)
{
	BPoint p;
	BPoint pIn;
	BPoint pOut;
	int32 count = fPath->CountPoints();
	Selection temp;
	for (int32 i = 0; i < count && fPath->GetPointsAt(i, p, pIn, pOut); i++) {
		if (r.Contains(p) || r.Contains(pIn) || r.Contains(pOut)) {
			temp.Add(i);
		}
	}
	// merge old and new selection
	count = fOldSelection->CountItems();
	for (int32 i = 0; i < count; i++) {
		int32 index = fOldSelection->IndexAt(i);
		if (temp.Contains(index))
			temp.Remove(index);
		else
			temp.Add(index);
	}
	if (temp != *fSelection) {
		*fSelection = temp;
		_UpdateSelection();
	}
}
Example #2
0
// ReversePath
void
PathManipulator::ReversePath()
{
	int32 count = fSelection->CountItems();
	int32 pointCount = fPath->CountPoints();
	if (count > 0) {
		Selection temp;
		for (int32 i = 0; i < count; i++) {
			temp.Add((pointCount - 1) - fSelection->IndexAt(i));
		}
		*fSelection = temp;
	}
	fPath->Reverse();
}
Example #3
0
// PathReversed
void
PathManipulator::PathReversed()
{
	// reverse selection along with path
	int32 count = fSelection->CountItems();
	int32 pointCount = fPath->CountPoints();
	if (count > 0) {
		Selection temp;
		for (int32 i = 0; i < count; i++) {
			temp.Add((pointCount - 1) - fSelection->IndexAt(i));
		}
		*fSelection = temp;
	}

	ObjectChanged(fPath);
}