Major UI changes, to use the checkboxes and radio buttons wherever

possible. This replaces all of the color-coded links, that I liked
but that were nonstandard.

Also rip out the old sweep and helical sweep UI; that was disabled,
but the code was still present.

And fix dependencies in makefile, since textwin.cpp depends on the
icons now.

[git-p4: depot-paths = "//depot/solvespace/": change = 2139]
solver
Jonathan Westhues 2010-05-09 10:25:23 -08:00
parent 2dbb21aecd
commit 8481c54012
13 changed files with 307 additions and 469 deletions

View File

@ -94,7 +94,9 @@ $(RES): win32/$(@B).rc icon.ico
toolbar.cpp: $(OBJDIR)/icons.h toolbar.cpp: $(OBJDIR)/icons.h
glhelper.cpp: bitmapfont.table font.table textwin.cpp: $(OBJDIR)/icons.h
glhelper.cpp: bitmapfont.table font.table bitmapextra.table
$(OBJDIR)/icons.h: icons/* png2c.pl $(OBJDIR)/icons.h: icons/* png2c.pl
perl png2c.pl $(OBJDIR)/icons.h $(OBJDIR)/icons-proto.h perl png2c.pl $(OBJDIR)/icons.h $(OBJDIR)/icons-proto.h

View File

@ -270,19 +270,19 @@ void TextWindow::ScreenChangePasteTransformed(int link, DWORD v) {
switch(link) { switch(link) {
case 't': case 't':
sprintf(str, "%d", SS.TW.shown.paste.times); sprintf(str, "%d", SS.TW.shown.paste.times);
ShowTextEditControl(10, 12, str); ShowTextEditControl(10, 13, str);
SS.TW.edit.meaning = EDIT_PASTE_TIMES_REPEATED; SS.TW.edit.meaning = EDIT_PASTE_TIMES_REPEATED;
break; break;
case 'r': case 'r':
sprintf(str, "%.3f", SS.TW.shown.paste.theta*180/PI); sprintf(str, "%.3f", SS.TW.shown.paste.theta*180/PI);
ShowTextEditControl(12, 12, str); ShowTextEditControl(12, 13, str);
SS.TW.edit.meaning = EDIT_PASTE_ANGLE; SS.TW.edit.meaning = EDIT_PASTE_ANGLE;
break; break;
case 's': case 's':
sprintf(str, "%.3f", SS.TW.shown.paste.scale); sprintf(str, "%.3f", SS.TW.shown.paste.scale);
ShowTextEditControl(18, 12, str); ShowTextEditControl(18, 13, str);
SS.TW.edit.meaning = EDIT_PASTE_SCALE; SS.TW.edit.meaning = EDIT_PASTE_SCALE;
break; break;
} }
@ -356,23 +356,23 @@ void TextWindow::ScreenPasteTransformed(int link, DWORD v) {
void TextWindow::ShowPasteTransformed(void) { void TextWindow::ShowPasteTransformed(void) {
Printf(true, "%FtPASTE TRANSFORMED%E"); Printf(true, "%FtPASTE TRANSFORMED%E");
Printf(true, "%Ba %FtREPEAT%E %d time%s %Fl%Lt%f[change]%E", Printf(true, "%Ba %Ftrepeat%E %d time%s %Fl%Lt%f[change]%E",
shown.paste.times, (shown.paste.times == 1) ? "" : "s", shown.paste.times, (shown.paste.times == 1) ? "" : "s",
&ScreenChangePasteTransformed); &ScreenChangePasteTransformed);
Printf(false, "%Bd %FtROTATE%E %@ degrees %Fl%Lr%f[change]%E", Printf(false, "%Bd %Ftrotate%E %@ degrees %Fl%Lr%f[change]%E",
shown.paste.theta*180/PI, shown.paste.theta*180/PI,
&ScreenChangePasteTransformed); &ScreenChangePasteTransformed);
Printf(false, "%Ba %FtABOUT PT%E (%s, %s, %s) %Fl%Lo%f[use selected]%E", Printf(false, "%Ba %Ftabout pt%E (%s, %s, %s) %Fl%Lo%f[use selected]%E",
SS.MmToString(shown.paste.origin.x), SS.MmToString(shown.paste.origin.x),
SS.MmToString(shown.paste.origin.y), SS.MmToString(shown.paste.origin.y),
SS.MmToString(shown.paste.origin.z), SS.MmToString(shown.paste.origin.z),
&ScreenPasteTransformed); &ScreenPasteTransformed);
Printf(false, "%Bd %FtTRANSLATE%E (%s, %s, %s) %Fl%Lt%f[use selected]%E", Printf(false, "%Bd %Fttranslate%E (%s, %s, %s) %Fl%Lt%f[use selected]%E",
SS.MmToString(shown.paste.trans.x), SS.MmToString(shown.paste.trans.x),
SS.MmToString(shown.paste.trans.y), SS.MmToString(shown.paste.trans.y),
SS.MmToString(shown.paste.trans.z), SS.MmToString(shown.paste.trans.z),
&ScreenPasteTransformed); &ScreenPasteTransformed);
Printf(false, "%Ba %FtSCALE%E %@ %Fl%Ls%f[change]%E", Printf(false, "%Ba %Ftscale%E %@ %Fl%Ls%f[change]%E",
shown.paste.scale, shown.paste.scale,
&ScreenChangePasteTransformed); &ScreenChangePasteTransformed);

View File

@ -15,7 +15,7 @@ void TextWindow::ScreenChangeLightDirection(int link, DWORD v) {
void TextWindow::ScreenChangeLightIntensity(int link, DWORD v) { void TextWindow::ScreenChangeLightIntensity(int link, DWORD v) {
char str[1024]; char str[1024];
sprintf(str, "%.2f", SS.lightIntensity[v]); sprintf(str, "%.2f", SS.lightIntensity[v]);
ShowTextEditControl(29+2*v, 30, str); ShowTextEditControl(29+2*v, 31, str);
SS.TW.edit.meaning = EDIT_LIGHT_INTENSITY; SS.TW.edit.meaning = EDIT_LIGHT_INTENSITY;
SS.TW.edit.i = v; SS.TW.edit.i = v;
} }
@ -26,7 +26,7 @@ void TextWindow::ScreenChangeColor(int link, DWORD v) {
REDf(SS.modelColor[v]), REDf(SS.modelColor[v]),
GREENf(SS.modelColor[v]), GREENf(SS.modelColor[v]),
BLUEf(SS.modelColor[v])); BLUEf(SS.modelColor[v]));
ShowTextEditControl(9+2*v, 12, str); ShowTextEditControl(9+2*v, 13, str);
SS.TW.edit.meaning = EDIT_COLOR; SS.TW.edit.meaning = EDIT_COLOR;
SS.TW.edit.i = v; SS.TW.edit.i = v;
} }
@ -95,7 +95,11 @@ void TextWindow::ScreenChangePwlCurves(int link, DWORD v) {
} }
void TextWindow::ScreenChangeCanvasSizeAuto(int link, DWORD v) { void TextWindow::ScreenChangeCanvasSizeAuto(int link, DWORD v) {
SS.exportCanvasSizeAuto = !SS.exportCanvasSizeAuto; if(link == 't') {
SS.exportCanvasSizeAuto = true;
} else {
SS.exportCanvasSizeAuto = false;
}
InvalidateGraphics(); InvalidateGraphics();
} }
@ -215,37 +219,28 @@ void TextWindow::ShowConfiguration(void) {
&ScreenChangeExportOffset, 0); &ScreenChangeExportOffset, 0);
Printf(false, ""); Printf(false, "");
Printf(false, "%Ft export shaded 2d triangles: " Printf(false, " %Fd%f%Ll%c export shaded 2d triangles%E",
"%Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E",
&ScreenChangeShadedTriangles, &ScreenChangeShadedTriangles,
(SS.exportShadedTriangles ? "" : "yes"), SS.exportShadedTriangles ? CHECK_TRUE : CHECK_FALSE);
(SS.exportShadedTriangles ? "yes" : ""),
&ScreenChangeShadedTriangles,
(!SS.exportShadedTriangles ? "" : "no"),
(!SS.exportShadedTriangles ? "no" : ""));
if(fabs(SS.exportOffset) > LENGTH_EPS) { if(fabs(SS.exportOffset) > LENGTH_EPS) {
Printf(false, "%Ft curves as piecewise linear:%E %Fsyes%Ft " Printf(false, " %Fd%c curves as piecewise linear%E "
"(since cutter radius is not zero)"); "(since cutter radius is not zero)", CHECK_TRUE);
} else { } else {
Printf(false, "%Ft curves as piecewise linear: " Printf(false, " %Fd%f%Ll%c export curves as piecewise linear%E",
"%Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E",
&ScreenChangePwlCurves, &ScreenChangePwlCurves,
(SS.exportPwlCurves ? "" : "yes"), SS.exportPwlCurves ? CHECK_TRUE : CHECK_FALSE);
(SS.exportPwlCurves ? "yes" : ""),
&ScreenChangePwlCurves,
(!SS.exportPwlCurves ? "" : "no"),
(!SS.exportPwlCurves ? "no" : ""));
} }
Printf(false, ""); Printf(false, "");
Printf(false, "%Ft export canvas size: " Printf(false, "%Ft export canvas size: "
"%Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E", "%f%Fd%Lf%c fixed%E "
"%f%Fd%Lt%c auto%E",
&ScreenChangeCanvasSizeAuto, &ScreenChangeCanvasSizeAuto,
(!SS.exportCanvasSizeAuto ? "" : "fixed"), !SS.exportCanvasSizeAuto ? RADIO_TRUE : RADIO_FALSE,
(!SS.exportCanvasSizeAuto ? "fixed" : ""),
&ScreenChangeCanvasSizeAuto, &ScreenChangeCanvasSizeAuto,
(SS.exportCanvasSizeAuto ? "" : "auto"), SS.exportCanvasSizeAuto ? RADIO_TRUE : RADIO_FALSE);
(SS.exportCanvasSizeAuto ? "auto" : ""));
if(SS.exportCanvasSizeAuto) { if(SS.exportCanvasSizeAuto) {
Printf(false, "%Ft (by margins around exported geometry)"); Printf(false, "%Ft (by margins around exported geometry)");
Printf(false, "%Ba%Ft left: %Fd%s %Fl%Ll%f%D[change]%E", Printf(false, "%Ba%Ft left: %Fd%s %Fl%Ll%f%D[change]%E",
@ -269,27 +264,15 @@ void TextWindow::ShowConfiguration(void) {
} }
Printf(false, ""); Printf(false, "");
Printf(false, "%Ft fix white exported lines: " Printf(false, " %Fd%f%Ll%c fix white exported lines%E",
"%Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E",
&ScreenChangeFixExportColors, &ScreenChangeFixExportColors,
( SS.fixExportColors ? "" : "yes"), ( SS.fixExportColors ? "yes" : ""), SS.fixExportColors ? CHECK_TRUE : CHECK_FALSE);
&ScreenChangeFixExportColors, Printf(false, " %Fd%f%Ll%c draw triangle back faces in red%E",
(!SS.fixExportColors ? "" : "no"), (!SS.fixExportColors ? "no" : ""));
Printf(false, "%Ft draw triangle back faces: "
"%Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E",
&ScreenChangeBackFaces, &ScreenChangeBackFaces,
(SS.drawBackFaces ? "" : "yes"), (SS.drawBackFaces ? "yes" : ""), SS.drawBackFaces ? CHECK_TRUE : CHECK_FALSE);
&ScreenChangeBackFaces, Printf(false, " %Fd%f%Ll%c check sketch for closed contour%E",
(!SS.drawBackFaces ? "" : "no"), (!SS.drawBackFaces ? "no" : ""));
bool ccc = (SS.checkClosedContour != 0);
Printf(false, "%Ft check for closed contour: "
"%Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E",
&ScreenChangeCheckClosedContour, &ScreenChangeCheckClosedContour,
(ccc ? "" : "yes"), (ccc ? "yes" : ""), SS.checkClosedContour ? CHECK_TRUE : CHECK_FALSE);
&ScreenChangeCheckClosedContour,
(!ccc ? "" : "no"), (!ccc ? "no" : ""));
Printf(false, ""); Printf(false, "");
Printf(false, "%Ft exported g code parameters"); Printf(false, "%Ft exported g code parameters");

View File

@ -516,6 +516,7 @@ void glxBitmapCharQuad(char c, double x, double y)
if(b & 0x80) { if(b & 0x80) {
// Special character, like a checkbox or a radio button // Special character, like a checkbox or a radio button
w = h = 16; w = h = 16;
x -= 3;
} else { } else {
// Normal character from our font // Normal character from our font
w = SS.TW.CHAR_WIDTH, w = SS.TW.CHAR_WIDTH,

View File

@ -75,8 +75,6 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
{ 1, NULL, 0, 0, NULL }, { 1, NULL, 0, 0, NULL },
{ 1, "E&xtrude\tShift+X", MNU_GROUP_EXTRUDE, 'X'|S, mGrp }, { 1, "E&xtrude\tShift+X", MNU_GROUP_EXTRUDE, 'X'|S, mGrp },
{ 1, "&Lathe\tShift+L", MNU_GROUP_LATHE, 'L'|S, mGrp }, { 1, "&Lathe\tShift+L", MNU_GROUP_LATHE, 'L'|S, mGrp },
//{ 1, "&Sweep\tShift+S", MNU_GROUP_SWEEP, 'S'|S, mGrp },
//{ 1, "&Helical Sweep\tShift+H", MNU_GROUP_HELICAL, 'H'|S, mGrp },
{ 1, NULL, 0, 0, NULL }, { 1, NULL, 0, 0, NULL },
{ 1, "Import / Assemble...\tShift+I", MNU_GROUP_IMPORT, 'I'|S, mGrp }, { 1, "Import / Assemble...\tShift+I", MNU_GROUP_IMPORT, 'I'|S, mGrp },
{11, "Import Recent", MNU_GROUP_RECENT, 0, mGrp }, {11, "Import Recent", MNU_GROUP_RECENT, 0, mGrp },

View File

@ -141,59 +141,6 @@ void Group::MenuGroup(int id) {
g.name.strcpy("lathe"); g.name.strcpy("lathe");
break; break;
case GraphicsWindow::MNU_GROUP_SWEEP: {
g.type = SWEEP;
// Get the group one before the active group; that's our
// trajectory
int i;
for(i = 1; i < SK.group.n - 1; i++) {
Group *gnext = &(SK.group.elem[i+1]);
if(gnext->h.v == SS.GW.activeGroup.v) {
g.opA = SK.group.elem[i].h;
break;
}
}
if(i >= SK.group.n - 1) {
Error("At least one sketch before the active sketch must "
"exist; that specifies the sweep trajectory.");
return;
}
// The active group is our section
g.opB = SS.GW.activeGroup;
g.name.strcpy("sweep");
break;
}
case GraphicsWindow::MNU_GROUP_HELICAL: {
if(gs.points == 1 && gs.lineSegments == 1 && gs.n == 2) {
Vector pt = SK.GetEntity(gs.point[0])->PointGetNum();
Entity *ln = SK.GetEntity(gs.entity[0]);
Vector lpa = SK.GetEntity(ln->point[0])->PointGetNum();
Vector lpb = SK.GetEntity(ln->point[1])->PointGetNum();
double d = pt.DistanceToLine(lpa, lpb.Minus(lpa));
if(d < LENGTH_EPS) {
Error("Point on helix can't lie on helix's axis!");
return;
}
g.predef.origin = gs.point[0];
g.predef.entityB = gs.entity[0];
} else {
Error("Bad selection for helical sweep. This group can "
"be created with:\n\n"
" * a line segment and a point (line segment "
"is axis of helix, point lies on helix)\n");
return;
}
g.type = HELICAL_SWEEP;
g.subtype = RIGHT_HANDED;
g.valA = 3; // turns;
g.valB = 300/SS.GW.scale; // pitch along axis
g.valC = 0; // pitch in radius
g.opA = SS.GW.activeGroup;
g.name.strcpy("helical-sweep");
break;
}
case GraphicsWindow::MNU_GROUP_ROT: { case GraphicsWindow::MNU_GROUP_ROT: {
if(gs.points == 1 && gs.n == 1 && SS.GW.LockedInWorkplane()) { if(gs.points == 1 && gs.n == 1 && SS.GW.LockedInWorkplane()) {
g.predef.origin = gs.point[0]; g.predef.origin = gs.point[0];
@ -443,14 +390,6 @@ void Group::Generate(IdList<Entity,hEntity> *entity,
break; break;
} }
case SWEEP: {
break;
}
case HELICAL_SWEEP: {
break;
}
case TRANSLATE: { case TRANSLATE: {
// The translation vector // The translation vector
AddParam(param, h.param(0), gp.x); AddParam(param, h.param(0), gp.x);

View File

@ -88,8 +88,6 @@ public:
static const int DRAWING_WORKPLANE = 5001; static const int DRAWING_WORKPLANE = 5001;
static const int EXTRUDE = 5100; static const int EXTRUDE = 5100;
static const int LATHE = 5101; static const int LATHE = 5101;
static const int SWEEP = 5102;
static const int HELICAL_SWEEP = 5103;
static const int ROTATE = 5200; static const int ROTATE = 5200;
static const int TRANSLATE = 5201; static const int TRANSLATE = 5201;
static const int IMPORTED = 5300; static const int IMPORTED = 5300;
@ -105,7 +103,6 @@ public:
double scale; double scale;
bool clean; bool clean;
bool vvMeshClean;
hEntity activeWorkplane; hEntity activeWorkplane;
double valA; double valA;
double valB; double valB;
@ -124,9 +121,6 @@ public:
// For extrudes, translates, and rotates // For extrudes, translates, and rotates
static const int ONE_SIDED = 7000; static const int ONE_SIDED = 7000;
static const int TWO_SIDED = 7001; static const int TWO_SIDED = 7001;
// For helical sweeps
static const int RIGHT_HANDED = 8000;
static const int LEFT_HANDED = 8001;
int subtype; int subtype;
bool skipFirst; // for step and repeat ops bool skipFirst; // for step and repeat ops

158
style.cpp
View File

@ -464,7 +464,7 @@ void TextWindow::ShowListOfStyles(void) {
void TextWindow::ScreenChangeStyleName(int link, DWORD v) { void TextWindow::ScreenChangeStyleName(int link, DWORD v) {
hStyle hs = { v }; hStyle hs = { v };
Style *s = Style::Get(hs); Style *s = Style::Get(hs);
ShowTextEditControl(10, 13, s->name.str); ShowTextEditControl(10, 12, s->name.str);
SS.TW.edit.style = hs; SS.TW.edit.style = hs;
SS.TW.edit.meaning = EDIT_STYLE_NAME; SS.TW.edit.meaning = EDIT_STYLE_NAME;
} }
@ -494,15 +494,16 @@ void TextWindow::ScreenChangeStyleWidthOrTextHeight(int link, DWORD v) {
} else { } else {
strcpy(str, SS.MmToString(val)); strcpy(str, SS.MmToString(val));
} }
int row = 0; int row = 0, col = 9;
if(link == 'w') { if(link == 'w') {
row = 16; // width for a default style row = 17; // width for a default style
} else if(link == 'W') { } else if(link == 'W') {
row = 16; // width for a custom style row = 17; // width for a custom style
} else if(link == 't') { } else if(link == 't') {
row = 27; // text height (for custom styles only) row = 33; // text height (for custom styles only)
col++;
} }
ShowTextEditControl(row, 13, str); ShowTextEditControl(row, col, str);
SS.TW.edit.style = hs; SS.TW.edit.style = hs;
SS.TW.edit.meaning = (link == 't') ? EDIT_STYLE_TEXT_HEIGHT : SS.TW.edit.meaning = (link == 't') ? EDIT_STYLE_TEXT_HEIGHT :
EDIT_STYLE_WIDTH; EDIT_STYLE_WIDTH;
@ -513,7 +514,7 @@ void TextWindow::ScreenChangeStyleTextAngle(int link, DWORD v) {
Style *s = Style::Get(hs); Style *s = Style::Get(hs);
char str[300]; char str[300];
sprintf(str, "%.2f", s->textAngle); sprintf(str, "%.2f", s->textAngle);
ShowTextEditControl(32, 13, str); ShowTextEditControl(37, 9, str);
SS.TW.edit.style = hs; SS.TW.edit.style = hs;
SS.TW.edit.meaning = EDIT_STYLE_TEXT_ANGLE; SS.TW.edit.meaning = EDIT_STYLE_TEXT_ANGLE;
} }
@ -525,11 +526,11 @@ void TextWindow::ScreenChangeStyleColor(int link, DWORD v) {
int row, col, em; int row, col, em;
DWORD rgb; DWORD rgb;
if(link == 's') { if(link == 's') {
row = 13; col = 17; row = 15; col = 13;
em = EDIT_STYLE_COLOR; em = EDIT_STYLE_COLOR;
rgb = s->color; rgb = s->color;
} else if(link == 'f') { } else if(link == 'f') {
row = 21; col = 17; row = 25; col = 13;
em = EDIT_STYLE_FILL_COLOR; em = EDIT_STYLE_FILL_COLOR;
rgb = s->fillColor; rgb = s->fillColor;
} else { } else {
@ -547,23 +548,30 @@ void TextWindow::ScreenChangeStyleYesNo(int link, DWORD v) {
hStyle hs = { v }; hStyle hs = { v };
Style *s = Style::Get(hs); Style *s = Style::Get(hs);
switch(link) { switch(link) {
case 'w':
// Units for the width // Units for the width
if(s->widthAs == Style::UNITS_AS_PIXELS) { case 'w':
if(s->widthAs != Style::UNITS_AS_MM) {
s->widthAs = Style::UNITS_AS_MM; s->widthAs = Style::UNITS_AS_MM;
s->width /= SS.GW.scale; s->width /= SS.GW.scale;
} else { }
break;
case 'W':
if(s->widthAs != Style::UNITS_AS_PIXELS) {
s->widthAs = Style::UNITS_AS_PIXELS; s->widthAs = Style::UNITS_AS_PIXELS;
s->width *= SS.GW.scale; s->width *= SS.GW.scale;
} }
break; break;
case 'h':
// Units for the height // Units for the height
if(s->textHeightAs == Style::UNITS_AS_PIXELS) { case 'g':
if(s->textHeightAs != Style::UNITS_AS_MM) {
s->textHeightAs = Style::UNITS_AS_MM; s->textHeightAs = Style::UNITS_AS_MM;
s->textHeight /= SS.GW.scale; s->textHeight /= SS.GW.scale;
} else { }
break;
case 'G':
if(s->textHeightAs != Style::UNITS_AS_PIXELS) {
s->textHeightAs = Style::UNITS_AS_PIXELS; s->textHeightAs = Style::UNITS_AS_PIXELS;
s->textHeight *= SS.GW.scale; s->textHeight *= SS.GW.scale;
} }
@ -708,19 +716,20 @@ void TextWindow::ShowStyleInfo(void) {
s->h.v, &ScreenDeleteStyle); s->h.v, &ScreenDeleteStyle);
} }
Printf(true, "%FtLINE COLOR %E%Bp %Bd (%@, %@, %@) %D%f%Ls%Fl[chng]%E", Printf(true, "%Ft line stroke style%E");
Printf(false, "%Ba %Ftcolor %E%Bp %Ba (%@, %@, %@) %D%f%Ls%Fl[change]%E",
0x80000000 | s->color, 0x80000000 | s->color,
REDf(s->color), GREENf(s->color), BLUEf(s->color), REDf(s->color), GREENf(s->color), BLUEf(s->color),
s->h.v, ScreenChangeStyleColor); s->h.v, ScreenChangeStyleColor);
// The line width, and its units // The line width, and its units
if(s->widthAs == Style::UNITS_AS_PIXELS) { if(s->widthAs == Style::UNITS_AS_PIXELS) {
Printf(true, "%FtLINE WIDTH %E%@ %D%f%Lp%Fl[change]%E", Printf(false, " %Ftwidth%E %@ %D%f%Lp%Fl[change]%E",
s->width, s->width,
s->h.v, &ScreenChangeStyleWidthOrTextHeight, s->h.v, &ScreenChangeStyleWidthOrTextHeight,
(s->h.v < Style::FIRST_CUSTOM) ? 'w' : 'W'); (s->h.v < Style::FIRST_CUSTOM) ? 'w' : 'W');
} else { } else {
Printf(true, "%FtLINE WIDTH %E%s %D%f%Lp%Fl[change]%E", Printf(false, " %Ftwidth%E %s %D%f%Lp%Fl[change]%E",
SS.MmToString(s->width), SS.MmToString(s->width),
s->h.v, &ScreenChangeStyleWidthOrTextHeight, s->h.v, &ScreenChangeStyleWidthOrTextHeight,
(s->h.v < Style::FIRST_CUSTOM) ? 'w' : 'W'); (s->h.v < Style::FIRST_CUSTOM) ? 'w' : 'W');
@ -728,45 +737,46 @@ void TextWindow::ShowStyleInfo(void) {
bool widthpx = (s->widthAs == Style::UNITS_AS_PIXELS); bool widthpx = (s->widthAs == Style::UNITS_AS_PIXELS);
if(s->h.v < Style::FIRST_CUSTOM) { if(s->h.v < Style::FIRST_CUSTOM) {
Printf(false,"%FtIN UNITS OF %Fspixels%E"); Printf(false,"%Ba %Ftin units of %Fdpixels%E");
} else { } else {
Printf(false,"%FtIN UNITS OF " Printf(false,"%Ba %Ftin units of %Fd"
"%Fh%D%f%Lw%s%E%Fs%s%E / %Fh%D%f%Lw%s%E%Fs%s%E", "%D%f%LW%c pixels%E "
"%D%f%Lw%c %s",
s->h.v, &ScreenChangeStyleYesNo, s->h.v, &ScreenChangeStyleYesNo,
( widthpx ? "" : "pixels"), widthpx ? RADIO_TRUE : RADIO_FALSE,
( widthpx ? "pixels" : ""),
s->h.v, &ScreenChangeStyleYesNo, s->h.v, &ScreenChangeStyleYesNo,
(!widthpx ? "" : SS.UnitName()), !widthpx ? RADIO_TRUE : RADIO_FALSE,
(!widthpx ? SS.UnitName() : "")); SS.UnitName());
} }
if(s->h.v >= Style::FIRST_CUSTOM) { if(s->h.v >= Style::FIRST_CUSTOM) {
// The fill color, and whether contours are filled // The fill color, and whether contours are filled
Printf(true,
"%FtFILL COLOR %E%Bp %Bd (%@, %@, %@) %D%f%Lf%Fl[chng]%E", Printf(false, "");
Printf(false, "%Ft contour fill style%E");
Printf(false,
"%Ba %Ftcolor %E%Bp %Ba (%@, %@, %@) %D%f%Lf%Fl[change]%E",
0x80000000 | s->fillColor, 0x80000000 | s->fillColor,
REDf(s->fillColor), GREENf(s->fillColor), BLUEf(s->fillColor), REDf(s->fillColor), GREENf(s->fillColor), BLUEf(s->fillColor),
s->h.v, ScreenChangeStyleColor); s->h.v, ScreenChangeStyleColor);
Printf(false, "%FtCONTOURS ARE %E"
"%Fh%D%f%Lf%s%E%Fs%s%E / %Fh%D%f%Lf%s%E%Fs%s%E", Printf(false, "%Bd %D%f%Lf%c contours are filled%E",
s->h.v, &ScreenChangeStyleYesNo, s->h.v, &ScreenChangeStyleYesNo,
( s->filled ? "" : "filled"), s->filled ? CHECK_TRUE : CHECK_FALSE);
( s->filled ? "filled" : ""),
s->h.v, &ScreenChangeStyleYesNo,
(!s->filled ? "" : "not filled"),
(!s->filled ? "not filled" : ""));
} }
// The text height, and its units // The text height, and its units
Printf(false, ""); Printf(false, "");
Printf(false, "%Ft text comment style%E");
char *chng = (s->h.v < Style::FIRST_CUSTOM) ? "" : "[change]"; char *chng = (s->h.v < Style::FIRST_CUSTOM) ? "" : "[change]";
if(s->textHeightAs == Style::UNITS_AS_PIXELS) { if(s->textHeightAs == Style::UNITS_AS_PIXELS) {
Printf(false, "%FtTEXT HEIGHT %E%@ %D%f%Lt%Fl%s%E", Printf(false, "%Ba %Ftheight %E%@ %D%f%Lt%Fl%s%E",
s->textHeight, s->textHeight,
s->h.v, &ScreenChangeStyleWidthOrTextHeight, s->h.v, &ScreenChangeStyleWidthOrTextHeight,
chng); chng);
} else { } else {
Printf(false, "%FtTEXT HEIGHT %E%s %D%f%Lt%Fl%s%E", Printf(false, "%Ba %Ftheight %E%s %D%f%Lt%Fl%s%E",
SS.MmToString(s->textHeight), SS.MmToString(s->textHeight),
s->h.v, &ScreenChangeStyleWidthOrTextHeight, s->h.v, &ScreenChangeStyleWidthOrTextHeight,
chng); chng);
@ -774,79 +784,65 @@ void TextWindow::ShowStyleInfo(void) {
bool textHeightpx = (s->textHeightAs == Style::UNITS_AS_PIXELS); bool textHeightpx = (s->textHeightAs == Style::UNITS_AS_PIXELS);
if(s->h.v < Style::FIRST_CUSTOM) { if(s->h.v < Style::FIRST_CUSTOM) {
Printf(false,"%FtIN UNITS OF %Fspixels%E"); Printf(false,"%Bd %Ftin units of %Fdpixels");
} else { } else {
Printf(false,"%FtIN UNITS OF " Printf(false,"%Bd %Ftin units of %Fd"
"%Fh%D%f%Lh%s%E%Fs%s%E / %Fh%D%f%Lh%s%E%Fs%s%E", "%D%f%LG%c pixels%E "
"%D%f%Lg%c %s",
s->h.v, &ScreenChangeStyleYesNo, s->h.v, &ScreenChangeStyleYesNo,
( textHeightpx ? "" : "pixels"), textHeightpx ? RADIO_TRUE : RADIO_FALSE,
( textHeightpx ? "pixels" : ""),
s->h.v, &ScreenChangeStyleYesNo, s->h.v, &ScreenChangeStyleYesNo,
(!textHeightpx ? "" : SS.UnitName()), !textHeightpx ? RADIO_TRUE : RADIO_FALSE,
(!textHeightpx ? SS.UnitName() : "")); SS.UnitName());
} }
if(s->h.v >= Style::FIRST_CUSTOM) { if(s->h.v >= Style::FIRST_CUSTOM) {
Printf(true, "%FtTEXT ANGLE %E%@ %D%f%Ll%Fl[change]%E", Printf(false, "%Ba %Ftangle %E%@ %D%f%Ll%Fl[change]%E",
s->textAngle, s->textAngle,
s->h.v, &ScreenChangeStyleTextAngle); s->h.v, &ScreenChangeStyleTextAngle);
Printf(false, "");
Printf(false, "%Ft text comment alignment%E");
bool neither; bool neither;
neither = !(s->textOrigin & (Style::ORIGIN_LEFT | Style::ORIGIN_RIGHT)); neither = !(s->textOrigin & (Style::ORIGIN_LEFT | Style::ORIGIN_RIGHT));
Printf(true, "%FtALIGN TEXT " Printf(false, "%Ba "
"%Fh%D%f%LL%s%E%Fs%s%E / " "%D%f%LL%c left%E "
"%Fh%D%f%LH%s%E%Fs%s%E / " "%D%f%LH%c center%E "
"%Fh%D%f%LR%s%E%Fs%s%E", "%D%f%LR%c right%E ",
s->h.v, &ScreenChangeStyleYesNo, s->h.v, &ScreenChangeStyleYesNo,
((s->textOrigin & Style::ORIGIN_LEFT) ? "" : "left"), (s->textOrigin & Style::ORIGIN_LEFT) ? RADIO_TRUE : RADIO_FALSE,
((s->textOrigin & Style::ORIGIN_LEFT) ? "left" : ""),
s->h.v, &ScreenChangeStyleYesNo, s->h.v, &ScreenChangeStyleYesNo,
(neither ? "" : "center"), neither ? RADIO_TRUE : RADIO_FALSE,
(neither ? "center" : ""),
s->h.v, &ScreenChangeStyleYesNo, s->h.v, &ScreenChangeStyleYesNo,
((s->textOrigin & Style::ORIGIN_RIGHT) ? "" : "right"), (s->textOrigin & Style::ORIGIN_RIGHT) ? RADIO_TRUE : RADIO_FALSE);
((s->textOrigin & Style::ORIGIN_RIGHT) ? "right" : ""));
neither = !(s->textOrigin & (Style::ORIGIN_BOT | Style::ORIGIN_TOP)); neither = !(s->textOrigin & (Style::ORIGIN_BOT | Style::ORIGIN_TOP));
Printf(false, "%Ft " Printf(false, "%Bd "
"%Fh%D%f%LB%s%E%Fs%s%E / " "%D%f%LB%c bottom%E "
"%Fh%D%f%LV%s%E%Fs%s%E / " "%D%f%LV%c center%E "
"%Fh%D%f%LT%s%E%Fs%s%E", "%D%f%LT%c top%E ",
s->h.v, &ScreenChangeStyleYesNo, s->h.v, &ScreenChangeStyleYesNo,
((s->textOrigin & Style::ORIGIN_BOT) ? "" : "bottom"), (s->textOrigin & Style::ORIGIN_BOT) ? RADIO_TRUE : RADIO_FALSE,
((s->textOrigin & Style::ORIGIN_BOT) ? "bottom" : ""),
s->h.v, &ScreenChangeStyleYesNo, s->h.v, &ScreenChangeStyleYesNo,
(neither ? "" : "center"), neither ? RADIO_TRUE : RADIO_FALSE,
(neither ? "center" : ""),
s->h.v, &ScreenChangeStyleYesNo, s->h.v, &ScreenChangeStyleYesNo,
((s->textOrigin & Style::ORIGIN_TOP) ? "" : "top"), (s->textOrigin & Style::ORIGIN_TOP) ? RADIO_TRUE : RADIO_FALSE);
((s->textOrigin & Style::ORIGIN_TOP) ? "top" : ""));
} }
if(s->h.v >= Style::FIRST_CUSTOM) { if(s->h.v >= Style::FIRST_CUSTOM) {
Printf(false, ""); Printf(false, "");
Printf(false,
"%FtOBJECTS ARE %Fh%D%f%Lv%s%E%Fs%s%E / %Fh%D%f%Lv%s%E%Fs%s%E", Printf(false, " %Fd%D%f%Lv%c show these objects on screen%E",
s->h.v, &ScreenChangeStyleYesNo, s->h.v, &ScreenChangeStyleYesNo,
( s->visible ? "" : "shown"), s->visible ? CHECK_TRUE : CHECK_FALSE);
( s->visible ? "shown" : ""),
Printf(false, " %Fd%D%f%Le%c export these objects%E",
s->h.v, &ScreenChangeStyleYesNo, s->h.v, &ScreenChangeStyleYesNo,
(!s->visible ? "" : "hidden"), s->exportable ? CHECK_TRUE : CHECK_FALSE);
(!s->visible ? "hidden" : ""));
Printf(false,
"%Ft %Fh%D%f%Le%s%E%Fs%s%E / %Fh%D%f%Le%s%E%Fs%s%E",
s->h.v, &ScreenChangeStyleYesNo,
( s->exportable ? "" : "exported"),
( s->exportable ? "exported" : ""),
s->h.v, &ScreenChangeStyleYesNo,
(!s->exportable ? "" : "not exported"),
(!s->exportable ? "not exported" : ""));
Printf(false, ""); Printf(false, "");
Printf(false, "To assign lines or curves to this style,"); Printf(false, "To assign lines or curves to this style,");
Printf(false, "select them on the drawing. Then commit"); Printf(false, "right-click them on the drawing.");
Printf(false, "by clicking the link at the bottom of");
Printf(false, "this window.");
} }
} }

View File

@ -91,7 +91,13 @@ void TextWindow::ScreenGoToWebsite(int link, DWORD v) {
OpenWebsite("http://solvespace.com/txtlink"); OpenWebsite("http://solvespace.com/txtlink");
} }
void TextWindow::ShowListOfGroups(void) { void TextWindow::ShowListOfGroups(void) {
Printf(true, "%Ftactv show ok group-name%E"); char radioTrue[] = { ' ', (char)RADIO_TRUE, ' ', 0 },
radioFalse[] = { ' ', (char)RADIO_FALSE, ' ', 0 },
checkTrue[] = { ' ', (char)CHECK_TRUE, ' ', 0 },
checkFalse[] = { ' ', (char)CHECK_FALSE, ' ', 0 };
Printf(true, "%Ft active");
Printf(false, "%Ft shown ok group-name%E");
int i; int i;
bool afterActive = false; bool afterActive = false;
for(i = 0; i < SK.group.n; i++) { for(i = 0; i < SK.group.n; i++) {
@ -102,21 +108,20 @@ void TextWindow::ShowListOfGroups(void) {
bool ok = (g->solved.how == System::SOLVED_OKAY); bool ok = (g->solved.how == System::SOLVED_OKAY);
bool ref = (g->h.v == Group::HGROUP_REFERENCES.v); bool ref = (g->h.v == Group::HGROUP_REFERENCES.v);
Printf(false, "%Bp%Fd " Printf(false, "%Bp%Fd "
"%Fp%D%f%s%Ll%s%E%s " "%Ft%s%Fb%D%f%Ll%s%E "
"%Fp%D%f%Ll%s%E%Fh%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", "%Fl%Ll%D%f%s",
// Alternate between light and dark backgrounds, for readability // Alternate between light and dark backgrounds, for readability
(i & 1) ? 'd' : 'a', (i & 1) ? 'd' : 'a',
// Link that activates the group // Link that activates the group
active ? 's' : 'h', g->h.v, (&TextWindow::ScreenActivateGroup), ref ? " " : "",
active ? "yes" : (ref ? " " : ""), g->h.v, (&TextWindow::ScreenActivateGroup),
active ? "" : (ref ? "" : "no"), ref ? "" : (active ? radioTrue : radioFalse),
active ? "" : " ",
// Link that hides or shows the group // Link that hides or shows the group
shown ? 's' : 'h', g->h.v, (&TextWindow::ScreenToggleGroupShown), afterActive ? " - " : "",
afterActive ? "" : (shown ? "yes" : "no"), g->h.v, (&TextWindow::ScreenToggleGroupShown),
afterActive ? " - " : (shown ? "" : " "), afterActive ? "" : (shown ? checkTrue : checkFalse),
// Link to the errors, if a problem occured while solving // Link to the errors, if a problem occured while solving
ok ? 's' : 'x', g->h.v, (&TextWindow::ScreenHowGroupSolved), ok ? 's' : 'x', g->h.v, (&TextWindow::ScreenHowGroupSolved),
ok ? "ok" : "", ok ? "ok" : "",
@ -205,34 +210,19 @@ void TextWindow::ScreenChangeGroupOption(int link, DWORD v) {
Group *g = SK.GetGroup(SS.TW.shown.group); Group *g = SK.GetGroup(SS.TW.shown.group);
switch(link) { switch(link) {
case 's': case 's': g->subtype = Group::ONE_SIDED; break;
if(g->subtype == Group::ONE_SIDED) { case 'S': g->subtype = Group::TWO_SIDED; break;
g->subtype = Group::TWO_SIDED;
} else {
g->subtype = Group::ONE_SIDED;
}
break;
case 'k': case 'k': g->skipFirst = true; break;
(g->skipFirst) = !(g->skipFirst); case 'K': g->skipFirst = false; break;
break;
case 'c': case 'c': g->meshCombine = v; break;
g->meshCombine = v;
break;
case 'P': case 'P': g->suppress = !(g->suppress); break;
g->suppress = !(g->suppress);
break;
case 'r': case 'r': g->relaxConstraints = !(g->relaxConstraints); break;
g->relaxConstraints = !(g->relaxConstraints);
break;
case 'f':
g->forceToMesh = !(g->forceToMesh);
break;
case 'f': g->forceToMesh = !(g->forceToMesh); break;
} }
SS.MarkGroupDirty(g->h); SS.MarkGroupDirty(g->h);
@ -240,39 +230,6 @@ void TextWindow::ScreenChangeGroupOption(int link, DWORD v) {
SS.GW.ClearSuper(); SS.GW.ClearSuper();
} }
void TextWindow::ScreenChangeRightLeftHanded(int link, DWORD v) {
SS.UndoRemember();
Group *g = SK.GetGroup(SS.TW.shown.group);
if(g->subtype == Group::RIGHT_HANDED) {
g->subtype = Group::LEFT_HANDED;
} else {
g->subtype = Group::RIGHT_HANDED;
}
SS.MarkGroupDirty(g->h);
SS.GenerateAll();
SS.GW.ClearSuper();
}
void TextWindow::ScreenChangeHelixParameter(int link, DWORD v) {
Group *g = SK.GetGroup(SS.TW.shown.group);
char str[1024];
int r;
if(link == 't') {
sprintf(str, "%.3f", g->valA);
SS.TW.edit.meaning = EDIT_HELIX_TURNS;
r = 12;
} else if(link == 'i') {
strcpy(str, SS.MmToString(g->valB));
SS.TW.edit.meaning = EDIT_HELIX_PITCH;
r = 14;
} else if(link == 'r') {
strcpy(str, SS.MmToString(g->valC));
SS.TW.edit.meaning = EDIT_HELIX_DRADIUS;
r = 16;
} else oops();
SS.TW.edit.group.v = v;
ShowTextEditControl(r, 9, str);
}
void TextWindow::ScreenColor(int link, DWORD v) { void TextWindow::ScreenColor(int link, DWORD v) {
SS.UndoRemember(); SS.UndoRemember();
@ -287,17 +244,17 @@ void TextWindow::ScreenChangeExprA(int link, DWORD v) {
Group *g = SK.GetGroup(SS.TW.shown.group); Group *g = SK.GetGroup(SS.TW.shown.group);
// There's an extra line for the skipFirst parameter in one-sided groups. // There's an extra line for the skipFirst parameter in one-sided groups.
int r = (g->subtype == Group::ONE_SIDED) ? 15 : 13; int r = (g->subtype == Group::ONE_SIDED) ? 16 : 14;
char str[1024]; char str[1024];
sprintf(str, "%d", (int)g->valA); sprintf(str, "%d", (int)g->valA);
ShowTextEditControl(r, 9, str); ShowTextEditControl(r, 10, str);
SS.TW.edit.meaning = EDIT_TIMES_REPEATED; SS.TW.edit.meaning = EDIT_TIMES_REPEATED;
SS.TW.edit.group.v = v; SS.TW.edit.group.v = v;
} }
void TextWindow::ScreenChangeGroupName(int link, DWORD v) { void TextWindow::ScreenChangeGroupName(int link, DWORD v) {
Group *g = SK.GetGroup(SS.TW.shown.group); Group *g = SK.GetGroup(SS.TW.shown.group);
ShowTextEditControl(7, 14, g->DescriptionString()+5); ShowTextEditControl(7, 12, g->DescriptionString()+5);
SS.TW.edit.meaning = EDIT_GROUP_NAME; SS.TW.edit.meaning = EDIT_GROUP_NAME;
SS.TW.edit.group.v = v; SS.TW.edit.group.v = v;
} }
@ -306,7 +263,7 @@ void TextWindow::ScreenChangeGroupScale(int link, DWORD v) {
char str[1024]; char str[1024];
sprintf(str, "%.3f", g->scale); sprintf(str, "%.3f", g->scale);
ShowTextEditControl(17, 9, str); ShowTextEditControl(14, 13, str);
SS.TW.edit.meaning = EDIT_GROUP_SCALE; SS.TW.edit.meaning = EDIT_GROUP_SCALE;
SS.TW.edit.group.v = v; SS.TW.edit.group.v = v;
} }
@ -327,94 +284,76 @@ void TextWindow::ScreenDeleteGroup(int link, DWORD v) {
} }
void TextWindow::ShowGroupInfo(void) { void TextWindow::ShowGroupInfo(void) {
Group *g = SK.group.FindById(shown.group); Group *g = SK.group.FindById(shown.group);
char *s, *s2, *s3; char *s = "???";
if(shown.group.v == Group::HGROUP_REFERENCES.v) { if(shown.group.v == Group::HGROUP_REFERENCES.v) {
Printf(true, "%FtGROUP %E%s", g->DescriptionString()); Printf(true, "%FtGROUP %E%s", g->DescriptionString());
goto list_items;
} else { } else {
Printf(true, "%FtGROUP %E%s " Printf(true, "%FtGROUP %E%s [%Fl%Ll%D%frename%E/%Fl%Ll%D%fdel%E]",
"[%Fl%Ll%D%frename%E/%Fl%Ll%D%fdel%E]",
g->DescriptionString(), g->DescriptionString(),
g->h.v, &TextWindow::ScreenChangeGroupName, g->h.v, &TextWindow::ScreenChangeGroupName,
g->h.v, &TextWindow::ScreenDeleteGroup); g->h.v, &TextWindow::ScreenDeleteGroup);
} }
if(g->type == Group::EXTRUDE) { if(g->type == Group::LATHE) {
s = "EXTRUDE "; Printf(true, " %Ftlathe plane sketch");
} else if(g->type == Group::TRANSLATE) { } else if(g->type == Group::EXTRUDE || g->type == Group::ROTATE ||
s = "TRANSLATE";
s2 ="REPEAT ";
s3 ="START ";
} else if(g->type == Group::ROTATE) {
s = "ROTATE ";
s2 ="REPEAT ";
s3 ="START ";
}
if(g->type == Group::EXTRUDE || g->type == Group::ROTATE ||
g->type == Group::TRANSLATE) g->type == Group::TRANSLATE)
{ {
if(g->type == Group::EXTRUDE) {
s = "extrude plane sketch";
} else if(g->type == Group::TRANSLATE) {
s = "translate original sketch";
} else if(g->type == Group::ROTATE) {
s = "rotate original sketch";
}
Printf(true, " %Ft%s%E", s);
bool one = (g->subtype == Group::ONE_SIDED); bool one = (g->subtype == Group::ONE_SIDED);
Printf(true, "%Ft%s%E %Fh%f%Ls%s%E%Fs%s%E / %Fh%f%Ls%s%E%Fs%s%E", s, Printf(false,
"%Ba %f%Ls%Fd%c one-sided%E "
"%f%LS%Fd%c two-sided%E",
&TextWindow::ScreenChangeGroupOption, &TextWindow::ScreenChangeGroupOption,
(one ? "" : "one side"), (one ? "one side" : ""), one ? RADIO_TRUE : RADIO_FALSE,
&TextWindow::ScreenChangeGroupOption, &TextWindow::ScreenChangeGroupOption,
(!one ? "" : "two sides"), (!one ? "two sides" : "")); !one ? RADIO_TRUE : RADIO_FALSE);
}
if(g->type == Group::LATHE) {
Printf(true, "%FtLATHE");
}
if(g->type == Group::SWEEP) {
Printf(true, "%FtSWEEP");
}
if(g->type == Group::HELICAL_SWEEP) {
bool rh = (g->subtype == Group::RIGHT_HANDED);
Printf(true,
"%FtHELICAL%E %Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E",
&ScreenChangeRightLeftHanded,
(rh ? "" : "right-hand"), (rh ? "right-hand" : ""),
&ScreenChangeRightLeftHanded,
(!rh ? "" : "left-hand"), (!rh ? "left-hand" : ""));
Printf(false, "%FtTHROUGH%E %@ turns %Fl%Lt%D%f[change]%E",
g->valA, g->h.v, &ScreenChangeHelixParameter);
Printf(false, "%FtPITCH%E %s axially per turn %Fl%Li%D%f[change]%E",
SS.MmToString(g->valB), g->h.v, &ScreenChangeHelixParameter);
Printf(false, "%FtdRADIUS%E %s radially per turn %Fl%Lr%D%f[change]%E",
SS.MmToString(g->valC), g->h.v, &ScreenChangeHelixParameter);
}
if(g->type == Group::ROTATE || g->type == Group::TRANSLATE) { if(g->type == Group::ROTATE || g->type == Group::TRANSLATE) {
bool space;
if(g->subtype == Group::ONE_SIDED) { if(g->subtype == Group::ONE_SIDED) {
bool skip = g->skipFirst; bool skip = g->skipFirst;
Printf(true, "%Ft%s%E %Fh%f%Lk%s%E%Fs%s%E / %Fh%f%Lk%s%E%Fs%s%E", Printf(false,
s3, "%Bd %Ftstart %f%LK%Fd%c with original%E "
"%f%Lk%Fd%c with copy #1%E",
&ScreenChangeGroupOption, &ScreenChangeGroupOption,
(!skip ? "" : "with original"), (!skip ? "with original" : ""), !skip ? RADIO_TRUE : RADIO_FALSE,
&ScreenChangeGroupOption, &ScreenChangeGroupOption,
(skip ? "":"with copy #1"), (skip ? "with copy #1":"")); skip ? RADIO_TRUE : RADIO_FALSE);
space = false;
} else {
space = true;
} }
int times = (int)(g->valA); int times = (int)(g->valA);
Printf(space, "%Ft%s%E %d time%s %Fl%Ll%D%f[change]%E", Printf(false, "%Bp %Ftrepeat%E %d time%s %Fl%Ll%D%f[change]%E",
s2, times, times == 1 ? "" : "s", (g->subtype == Group::ONE_SIDED) ? 'a' : 'd',
times, times == 1 ? "" : "s",
g->h.v, &TextWindow::ScreenChangeExprA); g->h.v, &TextWindow::ScreenChangeExprA);
} }
} else if(g->type == Group::IMPORTED) {
if(g->type == Group::IMPORTED) { Printf(true, " %Ftimport geometry from file%E");
Printf(true, "%FtIMPORT%E '%s'", g->impFileRel); Printf(false, "%Ba '%s'", g->impFileRel);
Printf(false, "%Bd %Ftscaled by%E %# %Fl%Ll%f%D[change]%E",
g->scale,
&TextWindow::ScreenChangeGroupScale, g->h.v);
} else if(g->type == Group::DRAWING_3D) {
Printf(true, " %Ftsketch in 3d%E");
} else if(g->type == Group::DRAWING_WORKPLANE) {
Printf(true, " %Ftsketch in new workplane%E");
} else {
Printf(true, "???");
} }
Printf(false, "");
if(g->type == Group::EXTRUDE || if(g->type == Group::EXTRUDE ||
g->type == Group::LATHE || g->type == Group::LATHE ||
g->type == Group::SWEEP ||
g->type == Group::HELICAL_SWEEP ||
g->type == Group::IMPORTED) g->type == Group::IMPORTED)
{ {
bool un = (g->meshCombine == Group::COMBINE_AS_UNION); bool un = (g->meshCombine == Group::COMBINE_AS_UNION);
@ -422,48 +361,27 @@ void TextWindow::ShowGroupInfo(void) {
bool asy = (g->meshCombine == Group::COMBINE_AS_ASSEMBLE); bool asy = (g->meshCombine == Group::COMBINE_AS_ASSEMBLE);
bool asa = (g->type == Group::IMPORTED); bool asa = (g->type == Group::IMPORTED);
Printf((g->type == Group::HELICAL_SWEEP), Printf(false, " %Ftsolid model as");
"%FtMERGE AS%E %Fh%f%D%Lc%s%E%Fs%s%E / %Fh%f%D%Lc%s%E%Fs%s%E %s " Printf(false, "%Ba %f%D%Lc%Fd%c union%E "
"%Fh%f%D%Lc%s%E%Fs%s%E", "%f%D%Lc%Fd%c difference%E "
"%f%D%Lc%Fd%c%s%E ",
&TextWindow::ScreenChangeGroupOption, &TextWindow::ScreenChangeGroupOption,
Group::COMBINE_AS_UNION, Group::COMBINE_AS_UNION,
(un ? "" : "union"), (un ? "union" : ""), un ? RADIO_TRUE : RADIO_FALSE,
&TextWindow::ScreenChangeGroupOption, &TextWindow::ScreenChangeGroupOption,
Group::COMBINE_AS_DIFFERENCE, Group::COMBINE_AS_DIFFERENCE,
(diff ? "" : "difference"), (diff ? "difference" : ""), diff ? RADIO_TRUE : RADIO_FALSE,
asa ? "/" : "",
&TextWindow::ScreenChangeGroupOption, &TextWindow::ScreenChangeGroupOption,
Group::COMBINE_AS_ASSEMBLE, Group::COMBINE_AS_ASSEMBLE,
(asy || !asa ? "" : "assemble"), (asy && asa ? "assemble" : "")); asa ? (asy ? RADIO_TRUE : RADIO_FALSE) : 0,
} asa ? " assemble" : "");
if(g->type == Group::IMPORTED) {
bool sup = g->suppress;
Printf(false, "%FtSUPPRESS%E %Fh%f%LP%s%E%Fs%s%E / %Fh%f%LP%s%E%Fs%s%E",
&TextWindow::ScreenChangeGroupOption,
(sup ? "" : "yes"), (sup ? "yes" : ""),
&TextWindow::ScreenChangeGroupOption,
(!sup ? "" : "no"), (!sup ? "no" : ""));
Printf(true, "%FtSCALE BY%E %# %Fl%Ll%f%D[change]%E",
g->scale,
&TextWindow::ScreenChangeGroupScale, g->h.v);
}
bool relax = g->relaxConstraints;
Printf(true, "%FtSOLVING%E %Fh%f%Lr%s%E%Fs%s%E / %Fh%f%Lr%s%E%Fs%s%E",
&TextWindow::ScreenChangeGroupOption,
(!relax ? "" : "with all constraints"),
(!relax ? "with all constraints" : ""),
&TextWindow::ScreenChangeGroupOption,
(relax ? "" : "no"), (relax ? "no" : ""));
if(g->type == Group::EXTRUDE || if(g->type == Group::EXTRUDE ||
g->type == Group::LATHE || g->type == Group::LATHE)
g->type == Group::SWEEP ||
g->type == Group::HELICAL_SWEEP)
{ {
#define TWOX(v) v v #define TWOX(v) v v
Printf(true, "%FtM_COLOR%E " TWOX(TWOX(TWOX("%Bp%D%f%Ln %Bd%E "))), Printf(false, "%Bd %Ftcolor%E "
TWOX(TWOX(TWOX("%Bp%D%f%Ln %Bd%E "))),
0x80000000 | SS.modelColor[0], 0, &TextWindow::ScreenColor, 0x80000000 | SS.modelColor[0], 0, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[1], 1, &TextWindow::ScreenColor, 0x80000000 | SS.modelColor[1], 1, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[2], 2, &TextWindow::ScreenColor, 0x80000000 | SS.modelColor[2], 2, &TextWindow::ScreenColor,
@ -472,41 +390,39 @@ void TextWindow::ShowGroupInfo(void) {
0x80000000 | SS.modelColor[5], 5, &TextWindow::ScreenColor, 0x80000000 | SS.modelColor[5], 5, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[6], 6, &TextWindow::ScreenColor, 0x80000000 | SS.modelColor[6], 6, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[7], 7, &TextWindow::ScreenColor); 0x80000000 | SS.modelColor[7], 7, &TextWindow::ScreenColor);
} else if(g->type == Group::IMPORTED) {
bool sup = g->suppress;
Printf(false, " %Fd%f%LP%c suppress this group's solid model",
&TextWindow::ScreenChangeGroupOption,
g->suppress ? CHECK_TRUE : CHECK_FALSE);
} }
if(shown.group.v != Group::HGROUP_REFERENCES.v && Printf(false, "");
(g->runningMesh.l.n > 0 ||
g->runningShell.surface.n > 0))
{
Group *pg = g->PreviousGroup();
if(pg->runningMesh.IsEmpty() && g->thisMesh.IsEmpty()) {
bool fm = g->forceToMesh;
Printf(true,
"%FtSURFACES%E %Fh%f%Lf%s%E%Fs%s%E / %Fh%f%Lf%s%E%Fs%s%E",
&TextWindow::ScreenChangeGroupOption,
(!fm ? "" : "as NURBS"), (!fm ? "as NURBS" : ""),
&TextWindow::ScreenChangeGroupOption,
(fm ? "" : "as mesh"), (fm ? "as mesh" : ""));
} else {
Printf(false,
"%FtSURFACES%E %Fsas mesh%E");
} }
Group *pg = g->PreviousGroup();
if(pg && pg->runningMesh.IsEmpty() && g->thisMesh.IsEmpty()) {
Printf(false, " %f%Lf%Fd%c force NURBS surfaces to triangle mesh",
&TextWindow::ScreenChangeGroupOption,
g->forceToMesh ? CHECK_TRUE : CHECK_FALSE);
} else {
Printf(false, " (model already forced to triangle mesh)");
}
Printf(false, " %f%Lr%Fd%c relax constraints and dimensions",
&TextWindow::ScreenChangeGroupOption,
g->relaxConstraints ? CHECK_TRUE : CHECK_FALSE);
if(g->booleanFailed) { if(g->booleanFailed) {
Printf(true, "The Boolean operation failed. It may be "); Printf(false, "");
Printf(false, "The Boolean operation failed. It may be ");
Printf(false, "possible to fix the problem by choosing "); Printf(false, "possible to fix the problem by choosing ");
Printf(false, "surfaces 'as mesh' instead of 'as NURBS'."); Printf(false, "'force NURBS surfaces to triangle mesh'.");
}
} }
// Leave more space if the group has configuration stuff above the req/ list_items:
// constraint list (as all but the drawing groups do).
if(g->type == Group::DRAWING_3D || g->type == Group::DRAWING_WORKPLANE) {
Printf(true, "%Ftrequests in group");
} else {
Printf(false, ""); Printf(false, "");
Printf(false, "%Ftrequests in group"); Printf(false, "%Ft requests in group");
}
int i, a = 0; int i, a = 0;
for(i = 0; i < SK.request.n; i++) { for(i = 0; i < SK.request.n; i++) {
@ -524,7 +440,8 @@ void TextWindow::ShowGroupInfo(void) {
if(a == 0) Printf(false, "%Ba (none)"); if(a == 0) Printf(false, "%Ba (none)");
a = 0; a = 0;
Printf(true, "%Ftconstraints in group (%d DOF)", g->solved.dof); Printf(false, "");
Printf(false, "%Ft constraints in group (%d DOF)", g->solved.dof);
for(i = 0; i < SK.constraint.n; i++) { for(i = 0; i < SK.constraint.n; i++) {
Constraint *c = &(SK.constraint.elem[i]); Constraint *c = &(SK.constraint.elem[i]);
@ -601,13 +518,13 @@ void TextWindow::ScreenStepDimFinish(int link, DWORD v) {
} else { } else {
sprintf(s, "%.3f", SS.TW.shown.dimFinish); sprintf(s, "%.3f", SS.TW.shown.dimFinish);
} }
ShowTextEditControl(12, 11, s); ShowTextEditControl(12, 12, s);
} }
void TextWindow::ScreenStepDimSteps(int link, DWORD v) { void TextWindow::ScreenStepDimSteps(int link, DWORD v) {
char str[1024]; char str[1024];
sprintf(str, "%d", SS.TW.shown.dimSteps); sprintf(str, "%d", SS.TW.shown.dimSteps);
SS.TW.edit.meaning = EDIT_STEP_DIM_STEPS; SS.TW.edit.meaning = EDIT_STEP_DIM_STEPS;
ShowTextEditControl(14, 11, str); ShowTextEditControl(14, 12, str);
} }
void TextWindow::ScreenStepDimGo(int link, DWORD v) { void TextWindow::ScreenStepDimGo(int link, DWORD v) {
hConstraint hc = SS.TW.shown.constraint; hConstraint hc = SS.TW.shown.constraint;
@ -642,15 +559,15 @@ void TextWindow::ShowStepDimension(void) {
Printf(true, "%FtSTEP DIMENSION%E %s", c->DescriptionString()); Printf(true, "%FtSTEP DIMENSION%E %s", c->DescriptionString());
if(shown.dimIsDistance) { if(shown.dimIsDistance) {
Printf(true, "%Ba %FtSTART%E %s", SS.MmToString(c->valA)); Printf(true, "%Ba %Ftstart%E %s", SS.MmToString(c->valA));
Printf(false, "%Bd %FtFINISH%E %s %Fl%Ll%f[change]%E", Printf(false, "%Bd %Ftfinish%E %s %Fl%Ll%f[change]%E",
SS.MmToString(shown.dimFinish), &ScreenStepDimFinish); SS.MmToString(shown.dimFinish), &ScreenStepDimFinish);
} else { } else {
Printf(true, "%Ba %FtSTART%E %@", c->valA); Printf(true, "%Ba %Ftstart%E %@", c->valA);
Printf(false, "%Bd %FtFINISH%E %@ %Fl%Ll%f[change]%E", Printf(false, "%Bd %Ftfinish%E %@ %Fl%Ll%f[change]%E",
shown.dimFinish, &ScreenStepDimFinish); shown.dimFinish, &ScreenStepDimFinish);
} }
Printf(false, "%Ba %FtSTEPS%E %d %Fl%Ll%f%D[change]%E", Printf(false, "%Ba %Ftsteps%E %d %Fl%Ll%f%D[change]%E",
shown.dimSteps, &ScreenStepDimSteps); shown.dimSteps, &ScreenStepDimSteps);
Printf(true, " %Fl%Ll%fstep dimension now%E", &ScreenStepDimGo); Printf(true, " %Fl%Ll%fstep dimension now%E", &ScreenStepDimGo);
@ -726,26 +643,6 @@ void TextWindow::EditControlDone(char *s) {
} }
break; break;
} }
case EDIT_HELIX_TURNS:
case EDIT_HELIX_PITCH:
case EDIT_HELIX_DRADIUS: {
SS.UndoRemember();
Group *g = SK.GetGroup(edit.group);
Expr *e = Expr::From(s, true);
if(!e) {
break;
}
if(edit.meaning == EDIT_HELIX_TURNS) {
g->valA = min(30, fabs(e->Eval()));
} else if(edit.meaning == EDIT_HELIX_PITCH) {
g->valB = SS.ExprToMm(e);
} else {
g->valC = SS.ExprToMm(e);
}
SS.MarkGroupDirty(g->h);
SS.later.generateAll = true;
break;
}
case EDIT_TTF_TEXT: { case EDIT_TTF_TEXT: {
SS.UndoRemember(); SS.UndoRemember();
Request *r = SK.request.FindByIdNoOops(edit.request); Request *r = SK.request.FindByIdNoOops(edit.request);

View File

@ -13,12 +13,13 @@ const TextWindow::Color TextWindow::fgColors[] = {
{ 'x', RGB(255, 20, 20) }, { 'x', RGB(255, 20, 20) },
{ 'i', RGB( 0, 255, 255) }, { 'i', RGB( 0, 255, 255) },
{ 'g', RGB(160, 160, 160) }, { 'g', RGB(160, 160, 160) },
{ 'b', RGB(200, 200, 200) },
{ 0, 0 }, { 0, 0 },
}; };
const TextWindow::Color TextWindow::bgColors[] = { const TextWindow::Color TextWindow::bgColors[] = {
{ 'd', RGB( 0, 0, 0) }, { 'd', RGB( 0, 0, 0) },
{ 't', RGB( 34, 15, 15) }, { 't', RGB( 34, 15, 15) },
{ 'a', RGB( 20, 20, 20) }, { 'a', RGB( 25, 25, 25) },
{ 'r', RGB(255, 255, 255) }, { 'r', RGB(255, 255, 255) },
{ 0, 0 }, { 0, 0 },
}; };
@ -146,7 +147,11 @@ void TextWindow::Printf(bool halfLine, char *fmt, ...) {
} }
case 'c': { case 'c': {
char v = va_arg(vl, char); char v = va_arg(vl, char);
if(v == 0) {
strcpy(buf, "");
} else {
sprintf(buf, "%c", v); sprintf(buf, "%c", v);
}
break; break;
} }
case 'E': case 'E':
@ -239,6 +244,8 @@ void TextWindow::Show(void) {
SS.GW.GroupSelection(); SS.GW.GroupSelection();
// Make sure these tests agree with test used to draw indicator line on
// main list of groups screen.
if(SS.GW.pending.description) { if(SS.GW.pending.description) {
// A pending operation (that must be completed with the mouse in // A pending operation (that must be completed with the mouse in
// the graphics window) will preempt our usual display. // the graphics window) will preempt our usual display.
@ -370,9 +377,9 @@ void TextWindow::DrawOrHitTestIcons(int how, double mx, double my)
if(tooltippedIcon->icon == Icon_faces) { if(tooltippedIcon->icon == Icon_faces) {
if(SS.GW.showFaces) { if(SS.GW.showFaces) {
strcpy(str, "Don't select faces with mouse"); strcpy(str, "Don't make faces selectable with mouse");
} else { } else {
strcpy(str, "Select faces with mouse"); strcpy(str, "Make faces selectable with mouse");
} }
} else { } else {
sprintf(str, "%s %s", *(tooltippedIcon->var) ? "Hide" : "Show", sprintf(str, "%s %s", *(tooltippedIcon->var) ? "Hide" : "Show",
@ -467,7 +474,7 @@ void TextWindow::Paint(void) {
if(bg & 0x80000000) { if(bg & 0x80000000) {
glColor3f(REDf(bg), GREENf(bg), BLUEf(bg)); glColor3f(REDf(bg), GREENf(bg), BLUEf(bg));
bh = CHAR_HEIGHT; bh = CHAR_HEIGHT;
adj = 2; adj += 2;
} else { } else {
glColor3fv(&(bgColorTable[bg*3])); glColor3fv(&(bgColorTable[bg*3]));
} }
@ -484,7 +491,7 @@ void TextWindow::Paint(void) {
glxBitmapCharQuad(text[r][c], x, y + CHAR_HEIGHT); glxBitmapCharQuad(text[r][c], x, y + CHAR_HEIGHT);
// If this is a link and it's hovered, then draw the // If this is a link and it's hovered, then draw the
// underline. // underline
if(meta[r][c].link && meta[r][c].link != 'n' && if(meta[r][c].link && meta[r][c].link != 'n' &&
(r == hoveredRow && c == hoveredCol)) (r == hoveredRow && c == hoveredCol))
{ {
@ -503,8 +510,20 @@ void TextWindow::Paint(void) {
{ {
cf++; cf++;
} }
// But don't underline checkboxes or radio buttons
while((text[r][cs] & 0x80 || text[r][cs] == ' ') &&
cs < cf)
{
cs++;
}
glEnd(); glEnd();
// Always use the color of the rightmost character
// in the link, so that underline is consistent color
fg = meta[r][cf-1].fg;
glColor3fv(&(fgColorTable[fg*3]));
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glLineWidth(1); glLineWidth(1);
glBegin(GL_LINES); glBegin(GL_LINES);
@ -524,6 +543,24 @@ void TextWindow::Paint(void) {
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
} }
// The line to indicate the column of radio buttons that indicates the
// active group.
SS.GW.GroupSelection();
// Make sure this test agrees with test to determine which screen is drawn
if(!SS.GW.pending.description && gs.n == 0 && gs.constraints == 0 &&
shown.screen == SCREEN_LIST_OF_GROUPS)
{
int x = 29, y = 70 + LINE_HEIGHT;
y -= scrollPos*(LINE_HEIGHT/2);
glLineWidth(1);
glColor3fv(&(fgColorTable['t'*3]));
glBegin(GL_LINES);
glVertex2d(x, y);
glVertex2d(x, y+40);
glEnd();
}
// The header has some icons that are drawn separately from the text // The header has some icons that are drawn separately from the text
DrawOrHitTestIcons(PAINT, 0, 0); DrawOrHitTestIcons(PAINT, 0, 0);
} }

8
ui.h
View File

@ -140,10 +140,6 @@ public:
static const int EDIT_G_CODE_PASSES = 111; static const int EDIT_G_CODE_PASSES = 111;
static const int EDIT_G_CODE_FEED = 112; static const int EDIT_G_CODE_FEED = 112;
static const int EDIT_G_CODE_PLUNGE_FEED = 113; static const int EDIT_G_CODE_PLUNGE_FEED = 113;
// For the helical sweep
static const int EDIT_HELIX_TURNS = 200;
static const int EDIT_HELIX_PITCH = 201;
static const int EDIT_HELIX_DRADIUS = 202;
// For TTF text // For TTF text
static const int EDIT_TTF_TEXT = 300; static const int EDIT_TTF_TEXT = 300;
// For the step dimension screen // For the step dimension screen
@ -217,8 +213,6 @@ public:
static void ScreenSelectConstraint(int link, DWORD v); static void ScreenSelectConstraint(int link, DWORD v);
static void ScreenChangeGroupOption(int link, DWORD v); static void ScreenChangeGroupOption(int link, DWORD v);
static void ScreenChangeRightLeftHanded(int link, DWORD v);
static void ScreenChangeHelixParameter(int link, DWORD v);
static void ScreenColor(int link, DWORD v); static void ScreenColor(int link, DWORD v);
static void ScreenShowListOfStyles(int link, DWORD v); static void ScreenShowListOfStyles(int link, DWORD v);
@ -347,8 +341,6 @@ public:
MNU_GROUP_WRKPL, MNU_GROUP_WRKPL,
MNU_GROUP_EXTRUDE, MNU_GROUP_EXTRUDE,
MNU_GROUP_LATHE, MNU_GROUP_LATHE,
MNU_GROUP_SWEEP,
MNU_GROUP_HELICAL,
MNU_GROUP_ROT, MNU_GROUP_ROT,
MNU_GROUP_TRANS, MNU_GROUP_TRANS,
MNU_GROUP_IMPORT, MNU_GROUP_IMPORT,

View File

@ -657,7 +657,7 @@ void ShowTextEditControl(int hr, int c, char *s)
int y = (hr - SS.TW.scrollPos)*(SS.TW.LINE_HEIGHT/2); int y = (hr - SS.TW.scrollPos)*(SS.TW.LINE_HEIGHT/2);
TextEditControlCol = c; TextEditControlCol = c;
TextEditControlHalfRow = hr; TextEditControlHalfRow = hr;
ShowEditControl(TextEditControl, x, y, s); ShowEditControl(TextEditControl, x - 1, y + 2, s);
} }
void HideTextEditControl(void) void HideTextEditControl(void)
{ {

View File

@ -1,4 +1,3 @@
add checked/unchecked checkbox and radio button
fix bug with rotation in plane where green line stays displayed fix bug with rotation in plane where green line stays displayed
group option to make dimensions always reference? group option to make dimensions always reference?
more tangencies, and rounding (of requests, not parametric) more tangencies, and rounding (of requests, not parametric)