Improve text screen for a selected entity.
* Add a link to its request, unless it's the first entity in that request (which would just select the same entity again). * Add a link to its group. * Add a link to its workplane. * Add a link to its style; and hide the style row for entities that aren't stylable. * Show constraints and measurements (reference constraints) in separate lists. * For curve entities, show constraints that apply to the points related to the curve, not just to the curve itself.
This commit is contained in:
parent
afa9e2890e
commit
a2962207dd
@ -221,52 +221,96 @@ void TextWindow::DescribeSelection() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Group *g = SK.GetGroup(e->group);
|
|
||||||
Printf(false, "");
|
Printf(false, "");
|
||||||
Printf(false, "%FtIN GROUP%E %s", g->DescriptionString().c_str());
|
if(e->h.isFromRequest()) {
|
||||||
|
Request *r = SK.GetRequest(e->h.request());
|
||||||
|
if(e->h == r->h.entity(0)) {
|
||||||
|
Printf(false, "%FtFROM REQUEST%E %s",
|
||||||
|
r->DescriptionString().c_str());
|
||||||
|
} else {
|
||||||
|
Printf(false, "%FtFROM REQUEST%E %Fl%Ll%D%f%h%s%E",
|
||||||
|
r->h.v, (&TextWindow::ScreenSelectRequest), &(TextWindow::ScreenHoverRequest),
|
||||||
|
r->DescriptionString().c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Group *g = SK.GetGroup(e->group);
|
||||||
|
Printf(false, "%FtIN GROUP%E %Fl%Ll%D%f%s%E",
|
||||||
|
g->h.v, (&TextWindow::ScreenSelectGroup),
|
||||||
|
g->DescriptionString().c_str());
|
||||||
if(e->workplane == Entity::FREE_IN_3D) {
|
if(e->workplane == Entity::FREE_IN_3D) {
|
||||||
Printf(false, "%FtNOT LOCKED IN WORKPLANE%E");
|
Printf(false, "%FtNOT LOCKED IN WORKPLANE%E");
|
||||||
} else {
|
} else {
|
||||||
Entity *w = SK.GetEntity(e->workplane);
|
Entity *w = SK.GetEntity(e->workplane);
|
||||||
Printf(false, "%FtIN WORKPLANE%E %s", w->DescriptionString().c_str());
|
if(w->h.isFromRequest()) {
|
||||||
|
Printf(false, "%FtIN WORKPLANE%E %Fl%Ll%D%f%h%s%E",
|
||||||
|
w->h.request().v,
|
||||||
|
(&TextWindow::ScreenSelectRequest), &(TextWindow::ScreenHoverRequest),
|
||||||
|
w->DescriptionString().c_str());
|
||||||
|
} else {
|
||||||
|
Printf(false, "%FtIN WORKPLANE%E %Fl%Ll%D%f%h%s%E",
|
||||||
|
w->h.group().v,
|
||||||
|
(&TextWindow::ScreenSelectGroup), (&TextWindow::ScreenHoverGroupWorkplane),
|
||||||
|
w->DescriptionString().c_str());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(e->IsStylable()) {
|
||||||
if(e->style.v) {
|
if(e->style.v) {
|
||||||
Style *s = Style::Get(e->style);
|
Style *s = Style::Get(e->style);
|
||||||
Printf(false, "%FtIN STYLE%E %s", s->DescriptionString().c_str());
|
Printf(false, "%FtIN STYLE%E %Fl%Ll%D%f%s%E",
|
||||||
|
s->h.v, (&TextWindow::ScreenShowStyleInfo),
|
||||||
|
s->DescriptionString().c_str());
|
||||||
} else {
|
} else {
|
||||||
Printf(false, "%FtIN STYLE%E none");
|
Printf(false, "%FtIN STYLE%E none");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(e->construction) {
|
if(e->construction) {
|
||||||
Printf(false, "%FtCONSTRUCTION");
|
Printf(false, "%FtCONSTRUCTION");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<hConstraint> lhc = {};
|
std::vector<hConstraint> lhc = {};
|
||||||
|
auto FindConstraints = [&](hEntity he) {
|
||||||
for(const Constraint &c : SK.constraint) {
|
for(const Constraint &c : SK.constraint) {
|
||||||
if(!(c.ptA == e->h ||
|
if(!(c.ptA == he || c.ptB == he ||
|
||||||
c.ptB == e->h ||
|
c.entityA == he || c.entityB == he || c.entityC == he || c.entityD == he))
|
||||||
c.entityA == e->h ||
|
|
||||||
c.entityB == e->h ||
|
|
||||||
c.entityC == e->h ||
|
|
||||||
c.entityD == e->h))
|
|
||||||
continue;
|
continue;
|
||||||
lhc.push_back(c.h);
|
lhc.push_back(c.h);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
FindConstraints(e->h);
|
||||||
|
if(!e->IsPoint()) {
|
||||||
|
for(int i = 0; i < MAX_POINTS_IN_ENTITY; i++) {
|
||||||
|
if(e->point[i].v == 0) break;
|
||||||
|
FindConstraints(e->point[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!lhc.empty()) {
|
std::sort(lhc.begin(), lhc.end());
|
||||||
Printf(true, "%FtCONSTRAINED BY:%E");
|
lhc.erase(std::unique(lhc.begin(), lhc.end()), lhc.end());
|
||||||
|
|
||||||
|
auto ListConstraints = [&](bool reference) {
|
||||||
|
bool first = true;
|
||||||
int a = 0;
|
int a = 0;
|
||||||
for(hConstraint hc : lhc) {
|
for(hConstraint hc : lhc) {
|
||||||
Constraint *c = SK.GetConstraint(hc);
|
Constraint *c = SK.GetConstraint(hc);
|
||||||
std::string s = c->DescriptionString();
|
if(c->reference != reference) continue;
|
||||||
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E %s",
|
if(first) {
|
||||||
|
first = false;
|
||||||
|
if(reference) {
|
||||||
|
Printf(true, "%FtMEASURED BY:%E");
|
||||||
|
} else {
|
||||||
|
Printf(true, "%FtCONSTRAINED BY:%E");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E",
|
||||||
(a & 1) ? 'd' : 'a',
|
(a & 1) ? 'd' : 'a',
|
||||||
c->h.v, (&TextWindow::ScreenSelectConstraint),
|
c->h.v, (&TextWindow::ScreenSelectConstraint),
|
||||||
(&TextWindow::ScreenHoverConstraint), s.c_str(),
|
(&TextWindow::ScreenHoverConstraint),
|
||||||
c->reference ? "(ref)" : "");
|
c->DescriptionString().c_str());
|
||||||
a++;
|
a++;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
ListConstraints(/*reference=*/false);
|
||||||
|
ListConstraints(/*reference=*/true);
|
||||||
} else if(gs.n == 2 && gs.points == 2) {
|
} else if(gs.n == 2 && gs.points == 2) {
|
||||||
Printf(false, "%FtTWO POINTS");
|
Printf(false, "%FtTWO POINTS");
|
||||||
Vector p0 = SK.GetEntity(gs.point[0])->PointGetNum();
|
Vector p0 = SK.GetEntity(gs.point[0])->PointGetNum();
|
||||||
|
@ -375,6 +375,7 @@ void TextWindow::ScreenShowListOfStyles(int link, uint32_t v) {
|
|||||||
SS.TW.GoToScreen(Screen::LIST_OF_STYLES);
|
SS.TW.GoToScreen(Screen::LIST_OF_STYLES);
|
||||||
}
|
}
|
||||||
void TextWindow::ScreenShowStyleInfo(int link, uint32_t v) {
|
void TextWindow::ScreenShowStyleInfo(int link, uint32_t v) {
|
||||||
|
GraphicsWindow::MenuEdit(Command::UNSELECT_ALL);
|
||||||
SS.TW.GoToScreen(Screen::STYLE_INFO);
|
SS.TW.GoToScreen(Screen::STYLE_INFO);
|
||||||
SS.TW.shown.style.v = v;
|
SS.TW.shown.style.v = v;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ void TextWindow::ShowHeader(bool withNav) {
|
|||||||
// to hide or show them, and to view them in detail. This is our home page.
|
// to hide or show them, and to view them in detail. This is our home page.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void TextWindow::ScreenSelectGroup(int link, uint32_t v) {
|
void TextWindow::ScreenSelectGroup(int link, uint32_t v) {
|
||||||
|
GraphicsWindow::MenuEdit(Command::UNSELECT_ALL);
|
||||||
SS.TW.GoToScreen(Screen::GROUP_INFO);
|
SS.TW.GoToScreen(Screen::GROUP_INFO);
|
||||||
SS.TW.shown.group.v = v;
|
SS.TW.shown.group.v = v;
|
||||||
}
|
}
|
||||||
@ -167,12 +168,16 @@ void TextWindow::ShowListOfGroups() {
|
|||||||
// The screen that shows information about a specific group, and allows the
|
// The screen that shows information about a specific group, and allows the
|
||||||
// user to edit various things about it.
|
// user to edit various things about it.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void TextWindow::ScreenHoverConstraint(int link, uint32_t v) {
|
void TextWindow::ScreenHoverGroupWorkplane(int link, uint32_t v) {
|
||||||
if(!SS.GW.showConstraints) return;
|
|
||||||
|
|
||||||
hConstraint hc = { v };
|
|
||||||
SS.GW.hover.Clear();
|
SS.GW.hover.Clear();
|
||||||
SS.GW.hover.constraint = hc;
|
hGroup hg = { v };
|
||||||
|
SS.GW.hover.entity = hg.entity(0);
|
||||||
|
SS.GW.hover.emphasized = true;
|
||||||
|
}
|
||||||
|
void TextWindow::ScreenHoverEntity(int link, uint32_t v) {
|
||||||
|
SS.GW.hover.Clear();
|
||||||
|
hEntity he = { v };
|
||||||
|
SS.GW.hover.entity = he;
|
||||||
SS.GW.hover.emphasized = true;
|
SS.GW.hover.emphasized = true;
|
||||||
}
|
}
|
||||||
void TextWindow::ScreenHoverRequest(int link, uint32_t v) {
|
void TextWindow::ScreenHoverRequest(int link, uint32_t v) {
|
||||||
@ -181,10 +186,19 @@ void TextWindow::ScreenHoverRequest(int link, uint32_t v) {
|
|||||||
SS.GW.hover.entity = hr.entity(0);
|
SS.GW.hover.entity = hr.entity(0);
|
||||||
SS.GW.hover.emphasized = true;
|
SS.GW.hover.emphasized = true;
|
||||||
}
|
}
|
||||||
void TextWindow::ScreenSelectConstraint(int link, uint32_t v) {
|
void TextWindow::ScreenHoverConstraint(int link, uint32_t v) {
|
||||||
|
if(!SS.GW.showConstraints) return;
|
||||||
|
|
||||||
|
hConstraint hc = { v };
|
||||||
|
SS.GW.hover.Clear();
|
||||||
|
SS.GW.hover.constraint = hc;
|
||||||
|
SS.GW.hover.emphasized = true;
|
||||||
|
}
|
||||||
|
void TextWindow::ScreenSelectEntity(int link, uint32_t v) {
|
||||||
SS.GW.ClearSelection();
|
SS.GW.ClearSelection();
|
||||||
GraphicsWindow::Selection sel = {};
|
GraphicsWindow::Selection sel = {};
|
||||||
sel.constraint.v = v;
|
hEntity he = { v };
|
||||||
|
sel.entity = he;
|
||||||
SS.GW.selection.Add(&sel);
|
SS.GW.selection.Add(&sel);
|
||||||
}
|
}
|
||||||
void TextWindow::ScreenSelectRequest(int link, uint32_t v) {
|
void TextWindow::ScreenSelectRequest(int link, uint32_t v) {
|
||||||
@ -194,6 +208,12 @@ void TextWindow::ScreenSelectRequest(int link, uint32_t v) {
|
|||||||
sel.entity = hr.entity(0);
|
sel.entity = hr.entity(0);
|
||||||
SS.GW.selection.Add(&sel);
|
SS.GW.selection.Add(&sel);
|
||||||
}
|
}
|
||||||
|
void TextWindow::ScreenSelectConstraint(int link, uint32_t v) {
|
||||||
|
SS.GW.ClearSelection();
|
||||||
|
GraphicsWindow::Selection sel = {};
|
||||||
|
sel.constraint.v = v;
|
||||||
|
SS.GW.selection.Add(&sel);
|
||||||
|
}
|
||||||
|
|
||||||
void TextWindow::ScreenChangeGroupOption(int link, uint32_t v) {
|
void TextWindow::ScreenChangeGroupOption(int link, uint32_t v) {
|
||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
|
5
src/ui.h
5
src/ui.h
@ -408,9 +408,12 @@ public:
|
|||||||
static void ScreenShowGroupsSpecial(int link, uint32_t v);
|
static void ScreenShowGroupsSpecial(int link, uint32_t v);
|
||||||
static void ScreenDeleteGroup(int link, uint32_t v);
|
static void ScreenDeleteGroup(int link, uint32_t v);
|
||||||
|
|
||||||
static void ScreenHoverConstraint(int link, uint32_t v);
|
static void ScreenHoverGroupWorkplane(int link, uint32_t v);
|
||||||
static void ScreenHoverRequest(int link, uint32_t v);
|
static void ScreenHoverRequest(int link, uint32_t v);
|
||||||
|
static void ScreenHoverEntity(int link, uint32_t v);
|
||||||
|
static void ScreenHoverConstraint(int link, uint32_t v);
|
||||||
static void ScreenSelectRequest(int link, uint32_t v);
|
static void ScreenSelectRequest(int link, uint32_t v);
|
||||||
|
static void ScreenSelectEntity(int link, uint32_t v);
|
||||||
static void ScreenSelectConstraint(int link, uint32_t v);
|
static void ScreenSelectConstraint(int link, uint32_t v);
|
||||||
|
|
||||||
static void ScreenChangeGroupOption(int link, uint32_t v);
|
static void ScreenChangeGroupOption(int link, uint32_t v);
|
||||||
|
Loading…
Reference in New Issue
Block a user