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 {
// 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);

View File

@ -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:

View File

@ -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 {

View File

@ -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)));

1
ui.h
View File

@ -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.