Show details for comments associated with points

Since 7e08b02de1 comments can be attached to
points.

Now when such a comment is selected the point (entity) it is associated to
will be shown in the text window together with it's coordinates and the
distance (offset) from the point to the comment.

Most of this was already prepared by Whitequark here
afa9e2890e
I just had to to remove the original 12 year old code by jwesthues that
showed "SELECTED: comment text" for comments.
(6750995ef0)

Fixes #1072
pull/1259/head
ruevs 2022-06-12 19:53:53 +03:00 committed by Paul Kahler
parent b48ce240c7
commit 1e1e655848
1 changed files with 7 additions and 2 deletions

View File

@ -428,14 +428,19 @@ void TextWindow::DescribeSelection() {
double d = (p1.Minus(p0)).Dot(n0);
Printf(true, " distance = %Fi%s", SS.MmToString(d).c_str());
}
} else if(gs.n == 0 && gs.stylables > 0) {
Printf(false, "%FtSELECTED:%E comment text");
} else if(gs.n == 0 && gs.constraints == 1) {
Constraint *c = SK.GetConstraint(gs.constraint[0]);
const std::string &desc = c->DescriptionString().c_str();
if(c->type == Constraint::Type::COMMENT) {
Printf(false, "%FtCOMMENT%E %s", desc.c_str());
if(c->ptA != Entity::NO_ENTITY) {
Vector p = SK.GetEntity(c->ptA)->PointGetNum();
Printf(true, " attached to point at: " PT_AS_STR, COSTR(SK.GetEntity(c->ptA), p));
Vector dv = c->disp.offset;
Printf(false, " distance = %Fi%s", SS.MmToString(dv.Magnitude()).c_str());
Printf(false, " d(x, y, z) = " PT_AS_STR_NO_LINK, COSTR_NO_LINK(dv));
}
} else if(c->HasLabel()) {
if(c->reference) {
Printf(false, "%FtREFERENCE%E %s", desc.c_str());