// connect to this dimension object at this point, instead of just becoming
// detached.
#endif
+//actually not true, we know the object pointer and parameter!
+//actuall, the Object base class does this for us...!
+#if 0
+ std::vector<Connection>::iterator i;
+
+ for(i=connected.begin(); i!=connected.end(); i++)
+ {
+ (*i).object->Disconnect(this, (*i).t);
+ }
+#endif
}
QString text = QObject::tr("Length: %1 in.\n") + QChar(0x2221) + QObject::tr(": %2");
text = text.arg(absLength).arg(absAngle);
-#if 0
- QPen pen = QPen(QColor(0x00, 0xFF, 0x00), 1.0, Qt::SolidLine);
- painter->SetPen(pen);
- painter->SetBrush(QBrush(QColor(0x40, 0xFF, 0x40, 0x9F)));
- QRectF textRect(10.0, 10.0, 270.0, 70.0); // x, y, w, h (in Qt coords)
- painter->DrawRoundedRect(textRect, 7.0, 7.0);
-
- textRect.setLeft(textRect.left() + 14);
- painter->SetFont(*Object::font);
- pen = QPen(QColor(0x00, 0x5F, 0xDF));
- painter->SetPen(pen);
- painter->DrawText(textRect, Qt::AlignVCenter, text);
-#else
painter->DrawInformativeText(text);
-#endif
}
}
what we can do here is set ignoreClicks to true to keep other objects that are
selected from deselecting themselves. Will that fuck up something else? Not sure
yet... :-/
+Actually, this is done here to keep tools from selecting stuff inadvertantly...
*/
- // Someone told us to fuck off, so we'll fuck off. :-)
- if (ignoreClicks)
- return false;
-
// We can assume this, since this is a mouse down event here.
objectWasDragged = false;
- HitTest(point);
+ bool hit = HitTest(point);
+
+ // Someone told us to fuck off, so we'll fuck off. :-)
+ if (ignoreClicks)
+// return false;
+ return hit;
// Now that we've done our hit testing on the non-snapped point, snap it if
// necessary...
}
-/*virtual*/ void Line::PointerMoved(Vector point)
+/*virtual*/ bool Line::PointerMoved(Vector point)
{
if (selectionInProgress)
{
// Check for whether or not the rect contains this line
-#if 0
- if (selection.normalized().contains(Extents()))
-#else
-// if (selection.normalized().contains(position.x, position.y)
-// && selection.normalized().contains(endpoint.x, endpoint.y))
if (selection.contains(position.x, position.y)
&& selection.contains(endpoint.x, endpoint.y))
-#endif
state = OSSelected;
else
state = OSInactive;
- return;
+ return false;
}
// Hit test tells us what we hit (if anything) through boolean variables. (It
// also tells us whether or not the state changed. --not any more)
SaveHitState();
- HitTest(point);
+ bool hovered = HitTest(point);
needUpdate = HitStateChanged();
objectWasDragged = (draggingLine | draggingHandle1 | draggingHandle2);
{
if ((*i).object->type == OTLine)
((Line *)((*i).object))->MovePointAtParameter((*i).t, delta);
+ else if ((*i).object->type == OTDimension)
+ ((Dimension *)((*i).object))->MovePointAtParameter((*i).t, delta);
}
}
}
dimPoint2->SetPoint2(draggingHandle2 ? v2 : endpoint);
#endif
}
+
+ return hovered;
}
void Line::SetDimensionOnLine(Dimension * dimension/*= NULL*/)
{
// If they don't pass one in, create it for the caller.
- if (dimension == NULL)
+ // But ONLY if this line has a parent container!
+ // This is really bad to do here, it should be done in the parent container, always!
+#warning "!!! Parent container should be creating Dimension object !!!"
+ if ((dimension == NULL) && (parent != NULL))
{
//printf("Line::SetDimensionOnLine(): Creating new dimension...\n");
-// dimension = new Dimension(position, endpoint, DTLinear, this);
- dimension = new Dimension(Connection(this, 0), Connection(this, 1.0), DTLinear, this);
+ dimension = new Dimension(position, endpoint, DTLinear, parent);
+// dimension = new Dimension(Connection(this, 0), Connection(this, 1.0), DTLinear, this);
- if (parent)
+ // THIS IS SERIOUS!!! WITHOUT A PARENT, THIS OBJECT IS IN LIMBO!!!
+// if (parent)
//{
//printf("Line::SetDimensionOnLine(): Adding to parent...\n");
- parent->Add(dimension);
+ parent->Add(dimension);
//}
}
- else
- {
- dimension->Connect(this, 0);
- dimension->Connect(this, 1.0);
- }
+
+ dimension->Connect(this, 0);
+ dimension->Connect(this, 1.0);
// Make sure the Dimension is connected to us...
Connect(dimension, 0);
Connect(dimension, 1.0);
+
+ dimension->position = position;
+ dimension->endpoint = endpoint;
}