diff --git a/draw.cpp b/draw.cpp index 13f85a1..1f59ff6 100644 --- a/draw.cpp +++ b/draw.cpp @@ -924,10 +924,8 @@ void GraphicsWindow::Paint(int w, int h) { } else { // Draw a red background whenever we're having solve problems. glClearColor(0.4f, 0, 0, 1.0f); - if(!showTextWindow) { - showTextWindow = true; - ShowTextWindow(TRUE); - } + // And show the text window, which has info to debug it + ForceTextWindowShown(); } glClearDepth(1.0); diff --git a/graphicswin.cpp b/graphicswin.cpp index af554c0..c2ca0c7 100644 --- a/graphicswin.cpp +++ b/graphicswin.cpp @@ -430,6 +430,14 @@ bool GraphicsWindow::LockedInWorkplane(void) { return (SS.GW.ActiveWorkplane().v != Entity::FREE_IN_3D.v); } +void GraphicsWindow::ForceTextWindowShown(void) { + if(!showTextWindow) { + showTextWindow = true; + CheckMenuById(MNU_SHOW_TEXT_WND, true); + ShowTextWindow(TRUE); + } +} + void GraphicsWindow::MenuEdit(int id) { switch(id) { case MNU_UNSELECT_ALL: diff --git a/solvespace.cpp b/solvespace.cpp index a50a61d..52b73be 100644 --- a/solvespace.cpp +++ b/solvespace.cpp @@ -373,6 +373,10 @@ void SolveSpace::MenuAnalyze(int id) { SS.TW.shown.constraint = c->h; SS.TW.shown.screen = TextWindow::SCREEN_STEP_DIMENSION; + // The step params are specified in the text window, + // so force that to be shown. + SS.GW.ForceTextWindowShown(); + SS.later.showTW = true; SS.GW.ClearSelection(); } else { diff --git a/textscreens.cpp b/textscreens.cpp index 5678ffd..8499273 100644 --- a/textscreens.cpp +++ b/textscreens.cpp @@ -929,13 +929,19 @@ void TextWindow::EditControlDone(char *s) { break; } - case EDIT_STEP_DIM_FINISH: + case EDIT_STEP_DIM_FINISH: { + Expr *e = Expr::From(s); + if(!e) { + Error("Not a valid number or expression: '%s'", s); + break; + } if(shown.dimIsDistance) { - shown.dimFinish = SS.StringToMm(s); + shown.dimFinish = SS.ExprToMm(e); } else { - shown.dimFinish = atof(s); + shown.dimFinish = e->Eval(); } break; + } case EDIT_STEP_DIM_STEPS: shown.dimSteps = min(300, max(1, atoi(s))); diff --git a/ui.h b/ui.h index 1cd56e2..261cbec 100644 --- a/ui.h +++ b/ui.h @@ -292,6 +292,7 @@ public: bool LockedInWorkplane(void); void SetWorkplaneFreeIn3d(void); hEntity ActiveWorkplane(void); + void ForceTextWindowShown(void); // Operations that must be completed by doing something with the mouse // are noted here. These occupy the same space as the menu ids.