Auto-show the text window when stepping a dimension, in addition to

auto-showing when a solve fails. And accept expressions, not just
numbers, for that new dimension value.

[git-p4: depot-paths = "//depot/solvespace/": change = 1877]
solver
Jonathan Westhues 2008-09-17 02:13:37 -08:00
parent 69cf8d6484
commit 23a4ce3697
5 changed files with 24 additions and 7 deletions

View File

@ -924,10 +924,8 @@ void GraphicsWindow::Paint(int w, int h) {
} else { } else {
// Draw a red background whenever we're having solve problems. // Draw a red background whenever we're having solve problems.
glClearColor(0.4f, 0, 0, 1.0f); glClearColor(0.4f, 0, 0, 1.0f);
if(!showTextWindow) { // And show the text window, which has info to debug it
showTextWindow = true; ForceTextWindowShown();
ShowTextWindow(TRUE);
}
} }
glClearDepth(1.0); glClearDepth(1.0);

View File

@ -430,6 +430,14 @@ bool GraphicsWindow::LockedInWorkplane(void) {
return (SS.GW.ActiveWorkplane().v != Entity::FREE_IN_3D.v); 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) { void GraphicsWindow::MenuEdit(int id) {
switch(id) { switch(id) {
case MNU_UNSELECT_ALL: case MNU_UNSELECT_ALL:

View File

@ -373,6 +373,10 @@ void SolveSpace::MenuAnalyze(int id) {
SS.TW.shown.constraint = c->h; SS.TW.shown.constraint = c->h;
SS.TW.shown.screen = TextWindow::SCREEN_STEP_DIMENSION; 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.later.showTW = true;
SS.GW.ClearSelection(); SS.GW.ClearSelection();
} else { } else {

View File

@ -929,13 +929,19 @@ void TextWindow::EditControlDone(char *s) {
break; 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) { if(shown.dimIsDistance) {
shown.dimFinish = SS.StringToMm(s); shown.dimFinish = SS.ExprToMm(e);
} else { } else {
shown.dimFinish = atof(s); shown.dimFinish = e->Eval();
} }
break; break;
}
case EDIT_STEP_DIM_STEPS: case EDIT_STEP_DIM_STEPS:
shown.dimSteps = min(300, max(1, atoi(s))); shown.dimSteps = min(300, max(1, atoi(s)));

1
ui.h
View File

@ -292,6 +292,7 @@ public:
bool LockedInWorkplane(void); bool LockedInWorkplane(void);
void SetWorkplaneFreeIn3d(void); void SetWorkplaneFreeIn3d(void);
hEntity ActiveWorkplane(void); hEntity ActiveWorkplane(void);
void ForceTextWindowShown(void);
// Operations that must be completed by doing something with the mouse // Operations that must be completed by doing something with the mouse
// are noted here. These occupy the same space as the menu ids. // are noted here. These occupy the same space as the menu ids.