Skip to content

Commit

Permalink
Show degrees of freedom in property browser.
Browse files Browse the repository at this point in the history
  • Loading branch information
bcmpinc authored and whitequark committed Jul 13, 2018
1 parent 4fab5b7 commit 8192c96
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -24,6 +24,7 @@ New sketch features:
* Datum points can be copied and pasted.
* "Split Curves at Intersection" can now split curves at point lying on curve,
not just at intersection of two curves.
* Property browser now shows amount of degrees of freedom in group list.

New constraint features:
* When dragging an arc or rectangle point, it will be automatically
Expand Down
19 changes: 14 additions & 5 deletions src/textscreens.cpp
Expand Up @@ -97,7 +97,7 @@ void TextWindow::ShowListOfGroups() {
*checkFalse = " " CHECK_FALSE " ";

Printf(true, "%Ft active");
Printf(false, "%Ft shown ok group-name%E");
Printf(false, "%Ft shown dof group-name%E");
int i;
bool afterActive = false;
for(i = 0; i < SK.groupOrder.n; i++) {
Expand All @@ -106,11 +106,20 @@ void TextWindow::ShowListOfGroups() {
bool active = (g->h.v == SS.GW.activeGroup.v);
bool shown = g->visible;
bool ok = g->IsSolvedOkay();
int dof = g->solved.dof;
char sdof[16] = "ok ";
if(ok && dof > 0) {
if(dof > 999) {
strcpy(sdof, "###");
} else {
sprintf(sdof, "%-3d", dof);
}
}
bool ref = (g->h.v == Group::HGROUP_REFERENCES.v);
Printf(false, "%Bp%Fd "
"%Ft%s%Fb%D%f%Ll%s%E "
"%Fb%s%D%f%Ll%s%E "
"%Fp%D%f%s%Ll%s%E "
"%Fp%D%f%s%Ll%s%E "
"%Fl%Ll%D%f%s",
// Alternate between light and dark backgrounds, for readability
(i & 1) ? 'd' : 'a',
Expand All @@ -123,9 +132,9 @@ void TextWindow::ShowListOfGroups() {
g->h.v, (&TextWindow::ScreenToggleGroupShown),
afterActive ? "" : (shown ? checkTrue : checkFalse),
// Link to the errors, if a problem occurred while solving
ok ? 's' : 'x', g->h.v, (&TextWindow::ScreenHowGroupSolved),
ok ? "ok" : "",
ok ? "" : "NO",
ok ? (dof > 0 ? 'i' : 's') : 'x', g->h.v, (&TextWindow::ScreenHowGroupSolved),
ok ? sdof : "",
ok ? "" : "ERR",
// Link to a screen that gives more details on the group
g->h.v, (&TextWindow::ScreenSelectGroup), s.c_str());

Expand Down
18 changes: 10 additions & 8 deletions src/textwin.cpp
Expand Up @@ -189,25 +189,27 @@ static Button *buttons[] = {
&occludedLinesButton,
};

/** Foreground color codes. */
const TextWindow::Color TextWindow::fgColors[] = {
{ 'd', RGBi(255, 255, 255) },
{ 'd', RGBi(255, 255, 255) }, // Default : white
{ 'l', RGBi(100, 100, 255) },
{ 't', RGBi(255, 200, 0) },
{ 'h', RGBi( 90, 90, 90) },
{ 's', RGBi( 40, 255, 40) },
{ 's', RGBi( 40, 255, 40) }, // Ok : green
{ 'm', RGBi(200, 200, 0) },
{ 'r', RGBi( 0, 0, 0) },
{ 'x', RGBi(255, 20, 20) },
{ 'i', RGBi( 0, 255, 255) },
{ 'r', RGBi( 0, 0, 0) }, // Reverse : black
{ 'x', RGBi(255, 20, 20) }, // Error : red
{ 'i', RGBi( 0, 255, 255) }, // Info : cyan
{ 'g', RGBi(160, 160, 160) },
{ 'b', RGBi(200, 200, 200) },
{ 0, RGBi( 0, 0, 0) }
};
/** Background color codes. */
const TextWindow::Color TextWindow::bgColors[] = {
{ 'd', RGBi( 0, 0, 0) },
{ 'd', RGBi( 0, 0, 0) }, // Default : black
{ 't', RGBi( 34, 15, 15) },
{ 'a', RGBi( 25, 25, 25) },
{ 'r', RGBi(255, 255, 255) },
{ 'a', RGBi( 25, 25, 25) }, // Alternate : dark gray
{ 'r', RGBi(255, 255, 255) }, // Reverse : white
{ 0, RGBi( 0, 0, 0) }
};

Expand Down

0 comments on commit 8192c96

Please sign in to comment.