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
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
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) {
case 't':
sprintf(str, "%d", SS.TW.shown.paste.times);
ShowTextEditControl(10, 12, str);
ShowTextEditControl(10, 13, str);
SS.TW.edit.meaning = EDIT_PASTE_TIMES_REPEATED;
break;
case 'r':
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;
break;
case 's':
sprintf(str, "%.3f", SS.TW.shown.paste.scale);
ShowTextEditControl(18, 12, str);
ShowTextEditControl(18, 13, str);
SS.TW.edit.meaning = EDIT_PASTE_SCALE;
break;
}
@ -356,23 +356,23 @@ void TextWindow::ScreenPasteTransformed(int link, DWORD v) {
void TextWindow::ShowPasteTransformed(void) {
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",
&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,
&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.y),
SS.MmToString(shown.paste.origin.z),
&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.y),
SS.MmToString(shown.paste.trans.z),
&ScreenPasteTransformed);
Printf(false, "%Ba %FtSCALE%E %@ %Fl%Ls%f[change]%E",
Printf(false, "%Ba %Ftscale%E %@ %Fl%Ls%f[change]%E",
shown.paste.scale,
&ScreenChangePasteTransformed);

View File

@ -15,7 +15,7 @@ void TextWindow::ScreenChangeLightDirection(int link, DWORD v) {
void TextWindow::ScreenChangeLightIntensity(int link, DWORD v) {
char str[1024];
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.i = v;
}
@ -26,7 +26,7 @@ void TextWindow::ScreenChangeColor(int link, DWORD v) {
REDf(SS.modelColor[v]),
GREENf(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.i = v;
}
@ -95,7 +95,11 @@ void TextWindow::ScreenChangePwlCurves(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();
}
@ -215,37 +219,28 @@ void TextWindow::ShowConfiguration(void) {
&ScreenChangeExportOffset, 0);
Printf(false, "");
Printf(false, "%Ft export shaded 2d triangles: "
"%Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E",
Printf(false, " %Fd%f%Ll%c export shaded 2d triangles%E",
&ScreenChangeShadedTriangles,
(SS.exportShadedTriangles ? "" : "yes"),
(SS.exportShadedTriangles ? "yes" : ""),
&ScreenChangeShadedTriangles,
(!SS.exportShadedTriangles ? "" : "no"),
(!SS.exportShadedTriangles ? "no" : ""));
SS.exportShadedTriangles ? CHECK_TRUE : CHECK_FALSE);
if(fabs(SS.exportOffset) > LENGTH_EPS) {
Printf(false, "%Ft curves as piecewise linear:%E %Fsyes%Ft "
"(since cutter radius is not zero)");
Printf(false, " %Fd%c curves as piecewise linear%E "
"(since cutter radius is not zero)", CHECK_TRUE);
} else {
Printf(false, "%Ft curves as piecewise linear: "
"%Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E",
Printf(false, " %Fd%f%Ll%c export curves as piecewise linear%E",
&ScreenChangePwlCurves,
(SS.exportPwlCurves ? "" : "yes"),
(SS.exportPwlCurves ? "yes" : ""),
&ScreenChangePwlCurves,
(!SS.exportPwlCurves ? "" : "no"),
(!SS.exportPwlCurves ? "no" : ""));
SS.exportPwlCurves ? CHECK_TRUE : CHECK_FALSE);
}
Printf(false, "");
Printf(false, "%Ft export canvas size: "
"%Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E",
Printf(false, "%Ft export canvas size: "
"%f%Fd%Lf%c fixed%E "
"%f%Fd%Lt%c auto%E",
&ScreenChangeCanvasSizeAuto,
(!SS.exportCanvasSizeAuto ? "" : "fixed"),
(!SS.exportCanvasSizeAuto ? "fixed" : ""),
!SS.exportCanvasSizeAuto ? RADIO_TRUE : RADIO_FALSE,
&ScreenChangeCanvasSizeAuto,
(SS.exportCanvasSizeAuto ? "" : "auto"),
(SS.exportCanvasSizeAuto ? "auto" : ""));
SS.exportCanvasSizeAuto ? RADIO_TRUE : RADIO_FALSE);
if(SS.exportCanvasSizeAuto) {
Printf(false, "%Ft (by margins around exported geometry)");
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, "%Ft fix white exported lines: "
"%Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E",
Printf(false, " %Fd%f%Ll%c fix white exported lines%E",
&ScreenChangeFixExportColors,
( SS.fixExportColors ? "" : "yes"), ( SS.fixExportColors ? "yes" : ""),
&ScreenChangeFixExportColors,
(!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",
SS.fixExportColors ? CHECK_TRUE : CHECK_FALSE);
Printf(false, " %Fd%f%Ll%c draw triangle back faces in red%E",
&ScreenChangeBackFaces,
(SS.drawBackFaces ? "" : "yes"), (SS.drawBackFaces ? "yes" : ""),
&ScreenChangeBackFaces,
(!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",
SS.drawBackFaces ? CHECK_TRUE : CHECK_FALSE);
Printf(false, " %Fd%f%Ll%c check sketch for closed contour%E",
&ScreenChangeCheckClosedContour,
(ccc ? "" : "yes"), (ccc ? "yes" : ""),
&ScreenChangeCheckClosedContour,
(!ccc ? "" : "no"), (!ccc ? "no" : ""));
SS.checkClosedContour ? CHECK_TRUE : CHECK_FALSE);
Printf(false, "");
Printf(false, "%Ft exported g code parameters");

View File

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

View File

@ -75,8 +75,6 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
{ 1, NULL, 0, 0, NULL },
{ 1, "E&xtrude\tShift+X", MNU_GROUP_EXTRUDE, 'X'|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, "Import / Assemble...\tShift+I", MNU_GROUP_IMPORT, 'I'|S, mGrp },
{11, "Import Recent", MNU_GROUP_RECENT, 0, mGrp },

View File

@ -141,59 +141,6 @@ void Group::MenuGroup(int id) {
g.name.strcpy("lathe");
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: {
if(gs.points == 1 && gs.n == 1 && SS.GW.LockedInWorkplane()) {
g.predef.origin = gs.point[0];
@ -443,14 +390,6 @@ void Group::Generate(IdList<Entity,hEntity> *entity,
break;
}
case SWEEP: {
break;
}
case HELICAL_SWEEP: {
break;
}
case TRANSLATE: {
// The translation vector
AddParam(param, h.param(0), gp.x);

View File

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

170
style.cpp
View File

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

View File

@ -91,7 +91,13 @@ void TextWindow::ScreenGoToWebsite(int link, DWORD v) {
OpenWebsite("http://solvespace.com/txtlink");
}
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;
bool afterActive = false;
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 ref = (g->h.v == Group::HGROUP_REFERENCES.v);
Printf(false, "%Bp%Fd "
"%Fp%D%f%s%Ll%s%E%s "
"%Fp%D%f%Ll%s%E%Fh%s%E "
"%Ft%s%Fb%D%f%Ll%s%E "
"%Fb%s%D%f%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',
(i & 1) ? 'd' : 'a',
// Link that activates the group
active ? 's' : 'h', g->h.v, (&TextWindow::ScreenActivateGroup),
active ? "yes" : (ref ? " " : ""),
active ? "" : (ref ? "" : "no"),
active ? "" : " ",
ref ? " " : "",
g->h.v, (&TextWindow::ScreenActivateGroup),
ref ? "" : (active ? radioTrue : radioFalse),
// Link that hides or shows the group
shown ? 's' : 'h', g->h.v, (&TextWindow::ScreenToggleGroupShown),
afterActive ? "" : (shown ? "yes" : "no"),
afterActive ? " - " : (shown ? "" : " "),
afterActive ? " - " : "",
g->h.v, (&TextWindow::ScreenToggleGroupShown),
afterActive ? "" : (shown ? checkTrue : checkFalse),
// Link to the errors, if a problem occured while solving
ok ? 's' : 'x', g->h.v, (&TextWindow::ScreenHowGroupSolved),
ok ? "ok" : "",
@ -205,34 +210,19 @@ void TextWindow::ScreenChangeGroupOption(int link, DWORD v) {
Group *g = SK.GetGroup(SS.TW.shown.group);
switch(link) {
case 's':
if(g->subtype == Group::ONE_SIDED) {
g->subtype = Group::TWO_SIDED;
} else {
g->subtype = Group::ONE_SIDED;
}
break;
case 's': g->subtype = Group::ONE_SIDED; break;
case 'S': g->subtype = Group::TWO_SIDED; break;
case 'k':
(g->skipFirst) = !(g->skipFirst);
break;
case 'k': g->skipFirst = true; break;
case 'K': g->skipFirst = false; break;
case 'c':
g->meshCombine = v;
break;
case 'c': g->meshCombine = v; break;
case 'P':
g->suppress = !(g->suppress);
break;
case 'P': g->suppress = !(g->suppress); break;
case 'r':
g->relaxConstraints = !(g->relaxConstraints);
break;
case 'f':
g->forceToMesh = !(g->forceToMesh);
break;
case 'r': g->relaxConstraints = !(g->relaxConstraints); break;
case 'f': g->forceToMesh = !(g->forceToMesh); break;
}
SS.MarkGroupDirty(g->h);
@ -240,39 +230,6 @@ void TextWindow::ScreenChangeGroupOption(int link, DWORD v) {
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) {
SS.UndoRemember();
@ -287,17 +244,17 @@ void TextWindow::ScreenChangeExprA(int link, DWORD v) {
Group *g = SK.GetGroup(SS.TW.shown.group);
// 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];
sprintf(str, "%d", (int)g->valA);
ShowTextEditControl(r, 9, str);
ShowTextEditControl(r, 10, str);
SS.TW.edit.meaning = EDIT_TIMES_REPEATED;
SS.TW.edit.group.v = v;
}
void TextWindow::ScreenChangeGroupName(int link, DWORD v) {
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.group.v = v;
}
@ -306,7 +263,7 @@ void TextWindow::ScreenChangeGroupScale(int link, DWORD v) {
char str[1024];
sprintf(str, "%.3f", g->scale);
ShowTextEditControl(17, 9, str);
ShowTextEditControl(14, 13, str);
SS.TW.edit.meaning = EDIT_GROUP_SCALE;
SS.TW.edit.group.v = v;
}
@ -327,94 +284,76 @@ void TextWindow::ScreenDeleteGroup(int link, DWORD v) {
}
void TextWindow::ShowGroupInfo(void) {
Group *g = SK.group.FindById(shown.group);
char *s, *s2, *s3;
char *s = "???";
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 {
Printf(true, "%FtGROUP %E%s "
"[%Fl%Ll%D%frename%E/%Fl%Ll%D%fdel%E]",
Printf(true, "%FtGROUP %E%s [%Fl%Ll%D%frename%E/%Fl%Ll%D%fdel%E]",
g->DescriptionString(),
g->h.v, &TextWindow::ScreenChangeGroupName,
g->h.v, &TextWindow::ScreenDeleteGroup);
}
if(g->type == Group::EXTRUDE) {
s = "EXTRUDE ";
} else if(g->type == Group::TRANSLATE) {
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)
{
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,
&TextWindow::ScreenChangeGroupOption,
(one ? "" : "one side"), (one ? "one side" : ""),
&TextWindow::ScreenChangeGroupOption,
(!one ? "" : "two sides"), (!one ? "two sides" : ""));
}
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) {
bool space;
if(g->subtype == Group::ONE_SIDED) {
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",
s3,
&ScreenChangeGroupOption,
(!skip ? "" : "with original"), (!skip ? "with original" : ""),
&ScreenChangeGroupOption,
(skip ? "":"with copy #1"), (skip ? "with copy #1":""));
space = false;
} else {
space = true;
Printf(true, " %Ftlathe plane sketch");
} else if(g->type == Group::EXTRUDE || g->type == Group::ROTATE ||
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);
int times = (int)(g->valA);
Printf(space, "%Ft%s%E %d time%s %Fl%Ll%D%f[change]%E",
s2, times, times == 1 ? "" : "s",
g->h.v, &TextWindow::ScreenChangeExprA);
}
if(g->type == Group::IMPORTED) {
Printf(true, "%FtIMPORT%E '%s'", g->impFileRel);
bool one = (g->subtype == Group::ONE_SIDED);
Printf(false,
"%Ba %f%Ls%Fd%c one-sided%E "
"%f%LS%Fd%c two-sided%E",
&TextWindow::ScreenChangeGroupOption,
one ? RADIO_TRUE : RADIO_FALSE,
&TextWindow::ScreenChangeGroupOption,
!one ? RADIO_TRUE : RADIO_FALSE);
if(g->type == Group::ROTATE || g->type == Group::TRANSLATE) {
if(g->subtype == Group::ONE_SIDED) {
bool skip = g->skipFirst;
Printf(false,
"%Bd %Ftstart %f%LK%Fd%c with original%E "
"%f%Lk%Fd%c with copy #1%E",
&ScreenChangeGroupOption,
!skip ? RADIO_TRUE : RADIO_FALSE,
&ScreenChangeGroupOption,
skip ? RADIO_TRUE : RADIO_FALSE);
}
int times = (int)(g->valA);
Printf(false, "%Bp %Ftrepeat%E %d time%s %Fl%Ll%D%f[change]%E",
(g->subtype == Group::ONE_SIDED) ? 'a' : 'd',
times, times == 1 ? "" : "s",
g->h.v, &TextWindow::ScreenChangeExprA);
}
} else if(g->type == Group::IMPORTED) {
Printf(true, " %Ftimport geometry from file%E");
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 ||
g->type == Group::LATHE ||
g->type == Group::SWEEP ||
g->type == Group::HELICAL_SWEEP ||
g->type == Group::IMPORTED)
{
bool un = (g->meshCombine == Group::COMBINE_AS_UNION);
@ -422,92 +361,69 @@ void TextWindow::ShowGroupInfo(void) {
bool asy = (g->meshCombine == Group::COMBINE_AS_ASSEMBLE);
bool asa = (g->type == Group::IMPORTED);
Printf((g->type == Group::HELICAL_SWEEP),
"%FtMERGE AS%E %Fh%f%D%Lc%s%E%Fs%s%E / %Fh%f%D%Lc%s%E%Fs%s%E %s "
"%Fh%f%D%Lc%s%E%Fs%s%E",
Printf(false, " %Ftsolid model as");
Printf(false, "%Ba %f%D%Lc%Fd%c union%E "
"%f%D%Lc%Fd%c difference%E "
"%f%D%Lc%Fd%c%s%E ",
&TextWindow::ScreenChangeGroupOption,
Group::COMBINE_AS_UNION,
(un ? "" : "union"), (un ? "union" : ""),
un ? RADIO_TRUE : RADIO_FALSE,
&TextWindow::ScreenChangeGroupOption,
Group::COMBINE_AS_DIFFERENCE,
(diff ? "" : "difference"), (diff ? "difference" : ""),
asa ? "/" : "",
diff ? RADIO_TRUE : RADIO_FALSE,
&TextWindow::ScreenChangeGroupOption,
Group::COMBINE_AS_ASSEMBLE,
(asy || !asa ? "" : "assemble"), (asy && 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" : ""));
asa ? (asy ? RADIO_TRUE : RADIO_FALSE) : 0,
asa ? " assemble" : "");
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 ||
g->type == Group::LATHE ||
g->type == Group::SWEEP ||
g->type == Group::HELICAL_SWEEP)
{
if(g->type == Group::EXTRUDE ||
g->type == Group::LATHE)
{
#define TWOX(v) v v
Printf(true, "%FtM_COLOR%E " TWOX(TWOX(TWOX("%Bp%D%f%Ln %Bd%E "))),
0x80000000 | SS.modelColor[0], 0, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[1], 1, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[2], 2, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[3], 3, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[4], 4, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[5], 5, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[6], 6, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[7], 7, &TextWindow::ScreenColor);
}
if(shown.group.v != Group::HGROUP_REFERENCES.v &&
(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");
Printf(false, "%Bd %Ftcolor%E "
TWOX(TWOX(TWOX("%Bp%D%f%Ln %Bd%E "))),
0x80000000 | SS.modelColor[0], 0, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[1], 1, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[2], 2, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[3], 3, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[4], 4, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[5], 5, &TextWindow::ScreenColor,
0x80000000 | SS.modelColor[6], 6, &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(g->booleanFailed) {
Printf(true, "The Boolean operation failed. It may be ");
Printf(false, "possible to fix the problem by choosing ");
Printf(false, "surfaces 'as mesh' instead of 'as NURBS'.");
}
}
// Leave more space if the group has configuration stuff above the req/
// 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, "%Ftrequests in group");
}
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) {
Printf(false, "");
Printf(false, "The Boolean operation failed. It may be ");
Printf(false, "possible to fix the problem by choosing ");
Printf(false, "'force NURBS surfaces to triangle mesh'.");
}
list_items:
Printf(false, "");
Printf(false, "%Ft requests in group");
int i, a = 0;
for(i = 0; i < SK.request.n; i++) {
Request *r = &(SK.request.elem[i]);
@ -524,7 +440,8 @@ void TextWindow::ShowGroupInfo(void) {
if(a == 0) Printf(false, "%Ba (none)");
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++) {
Constraint *c = &(SK.constraint.elem[i]);
@ -601,13 +518,13 @@ void TextWindow::ScreenStepDimFinish(int link, DWORD v) {
} else {
sprintf(s, "%.3f", SS.TW.shown.dimFinish);
}
ShowTextEditControl(12, 11, s);
ShowTextEditControl(12, 12, s);
}
void TextWindow::ScreenStepDimSteps(int link, DWORD v) {
char str[1024];
sprintf(str, "%d", SS.TW.shown.dimSteps);
SS.TW.edit.meaning = EDIT_STEP_DIM_STEPS;
ShowTextEditControl(14, 11, str);
ShowTextEditControl(14, 12, str);
}
void TextWindow::ScreenStepDimGo(int link, DWORD v) {
hConstraint hc = SS.TW.shown.constraint;
@ -642,15 +559,15 @@ void TextWindow::ShowStepDimension(void) {
Printf(true, "%FtSTEP DIMENSION%E %s", c->DescriptionString());
if(shown.dimIsDistance) {
Printf(true, "%Ba %FtSTART%E %s", SS.MmToString(c->valA));
Printf(false, "%Bd %FtFINISH%E %s %Fl%Ll%f[change]%E",
Printf(true, "%Ba %Ftstart%E %s", SS.MmToString(c->valA));
Printf(false, "%Bd %Ftfinish%E %s %Fl%Ll%f[change]%E",
SS.MmToString(shown.dimFinish), &ScreenStepDimFinish);
} else {
Printf(true, "%Ba %FtSTART%E %@", c->valA);
Printf(false, "%Bd %FtFINISH%E %@ %Fl%Ll%f[change]%E",
Printf(true, "%Ba %Ftstart%E %@", c->valA);
Printf(false, "%Bd %Ftfinish%E %@ %Fl%Ll%f[change]%E",
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);
Printf(true, " %Fl%Ll%fstep dimension now%E", &ScreenStepDimGo);
@ -726,26 +643,6 @@ void TextWindow::EditControlDone(char *s) {
}
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: {
SS.UndoRemember();
Request *r = SK.request.FindByIdNoOops(edit.request);

View File

@ -13,12 +13,13 @@ const TextWindow::Color TextWindow::fgColors[] = {
{ 'x', RGB(255, 20, 20) },
{ 'i', RGB( 0, 255, 255) },
{ 'g', RGB(160, 160, 160) },
{ 'b', RGB(200, 200, 200) },
{ 0, 0 },
};
const TextWindow::Color TextWindow::bgColors[] = {
{ 'd', RGB( 0, 0, 0) },
{ 't', RGB( 34, 15, 15) },
{ 'a', RGB( 20, 20, 20) },
{ 'a', RGB( 25, 25, 25) },
{ 'r', RGB(255, 255, 255) },
{ 0, 0 },
};
@ -146,7 +147,11 @@ void TextWindow::Printf(bool halfLine, char *fmt, ...) {
}
case 'c': {
char v = va_arg(vl, char);
sprintf(buf, "%c", v);
if(v == 0) {
strcpy(buf, "");
} else {
sprintf(buf, "%c", v);
}
break;
}
case 'E':
@ -239,6 +244,8 @@ void TextWindow::Show(void) {
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) {
// A pending operation (that must be completed with the mouse in
// 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(SS.GW.showFaces) {
strcpy(str, "Don't select faces with mouse");
strcpy(str, "Don't make faces selectable with mouse");
} else {
strcpy(str, "Select faces with mouse");
strcpy(str, "Make faces selectable with mouse");
}
} else {
sprintf(str, "%s %s", *(tooltippedIcon->var) ? "Hide" : "Show",
@ -467,7 +474,7 @@ void TextWindow::Paint(void) {
if(bg & 0x80000000) {
glColor3f(REDf(bg), GREENf(bg), BLUEf(bg));
bh = CHAR_HEIGHT;
adj = 2;
adj += 2;
} else {
glColor3fv(&(bgColorTable[bg*3]));
}
@ -484,7 +491,7 @@ void TextWindow::Paint(void) {
glxBitmapCharQuad(text[r][c], x, y + CHAR_HEIGHT);
// If this is a link and it's hovered, then draw the
// underline.
// underline
if(meta[r][c].link && meta[r][c].link != 'n' &&
(r == hoveredRow && c == hoveredCol))
{
@ -503,8 +510,20 @@ void TextWindow::Paint(void) {
{
cf++;
}
// But don't underline checkboxes or radio buttons
while((text[r][cs] & 0x80 || text[r][cs] == ' ') &&
cs < cf)
{
cs++;
}
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);
glLineWidth(1);
glBegin(GL_LINES);
@ -524,6 +543,24 @@ void TextWindow::Paint(void) {
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
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_FEED = 112;
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
static const int EDIT_TTF_TEXT = 300;
// For the step dimension screen
@ -217,8 +213,6 @@ public:
static void ScreenSelectConstraint(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 ScreenShowListOfStyles(int link, DWORD v);
@ -347,8 +341,6 @@ public:
MNU_GROUP_WRKPL,
MNU_GROUP_EXTRUDE,
MNU_GROUP_LATHE,
MNU_GROUP_SWEEP,
MNU_GROUP_HELICAL,
MNU_GROUP_ROT,
MNU_GROUP_TRANS,
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);
TextEditControlCol = c;
TextEditControlHalfRow = hr;
ShowEditControl(TextEditControl, x, y, s);
ShowEditControl(TextEditControl, x - 1, y + 2, s);
}
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
group option to make dimensions always reference?
more tangencies, and rounding (of requests, not parametric)