From 5d9356a90a800393af67f46f85d4e5316b132a5d Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 17 Jan 2017 11:32:50 +0000 Subject: [PATCH] List constrained requests when selecting a constraint. --- CHANGELOG.md | 2 ++ src/describescreen.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ea546b..bf4173f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ New sketch features: New constraint features: * When dragging an arc or rectangle point, it will be automatically constrained to other points with a click. + * When selecting a constraint, the requests it constraints can be selected + in the text window. New export/import features: * Three.js: allow configuring projection for exported model, and initially diff --git a/src/describescreen.cpp b/src/describescreen.cpp index 46670ae..2d2a801 100644 --- a/src/describescreen.cpp +++ b/src/describescreen.cpp @@ -341,6 +341,35 @@ void TextWindow::DescribeSelection() { Printf(false, "%FtSELECTED:%E %s", c->DescriptionString().c_str()); } + + std::vector lhe = {}; + lhe.push_back(c->ptA); + lhe.push_back(c->ptB); + lhe.push_back(c->entityA); + lhe.push_back(c->entityB); + lhe.push_back(c->entityC); + lhe.push_back(c->entityD); + + auto it = std::remove_if(lhe.begin(), lhe.end(), + [](hEntity he) { + return he.v == Entity::NO_ENTITY.v || !he.isFromRequest(); + }); + lhe.erase(it, lhe.end()); + + if(!lhe.empty()) { + Printf(true, "%FtCONSTRAINED REQUESTS:%E"); + + int a = 0; + for(hEntity he : lhe) { + Request *r = SK.GetRequest(he.request()); + std::string s = r->DescriptionString(); + Printf(false, "%Bp %Fl%Ll%D%f%h%s%E", + (a & 1) ? 'd' : 'a', + r->h.v, (&TextWindow::ScreenSelectRequest), + &(TextWindow::ScreenHoverRequest), s.c_str()); + a++; + } + } } else { int n = SS.GW.selection.n; Printf(false, "%FtSELECTED:%E %d item%s", n, n == 1 ? "" : "s");