Now I can rename groups, using that same edit control in the text
window. [git-p4: depot-paths = "//depot/solvespace/": change = 1750]
This commit is contained in:
parent
4375c01c51
commit
010a65894d
35
polygon.h
35
polygon.h
|
@ -161,7 +161,6 @@ public:
|
||||||
void DebugDraw(void);
|
void DebugDraw(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SMesh {
|
class SMesh {
|
||||||
public:
|
public:
|
||||||
SList<STriangle> l;
|
SList<STriangle> l;
|
||||||
|
@ -184,5 +183,39 @@ public:
|
||||||
void MakeFromDifference(SMesh *a, SMesh *b);
|
void MakeFromDifference(SMesh *a, SMesh *b);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// A linked list of triangles
|
||||||
|
class STriangleLl {
|
||||||
|
public:
|
||||||
|
int tag;
|
||||||
|
STriangle tri;
|
||||||
|
|
||||||
|
STriangleLl *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
// A linked list of linked lists of triangles; extra layer of encapsulation
|
||||||
|
// required because the same triangle might appear in both branches of the
|
||||||
|
// tree, if it spans the split plane, and we will need to be able to split
|
||||||
|
// the triangle into multiple pieces as we remove T intersections.
|
||||||
|
class STriangleLl2 {
|
||||||
|
public:
|
||||||
|
STriangleLl *trl;
|
||||||
|
|
||||||
|
STriangleLl2 *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SAxisAligned {
|
||||||
|
public:
|
||||||
|
static const int BY_X = 1;
|
||||||
|
static const int BY_Y = 2;
|
||||||
|
static const int BY_Z = 3;
|
||||||
|
int which;
|
||||||
|
double c;
|
||||||
|
|
||||||
|
SAxisAligned *gt;
|
||||||
|
SAxisAligned *lt;
|
||||||
|
|
||||||
|
STriangleLl2 *tris;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ void Group::MenuGroup(int id) {
|
||||||
case GraphicsWindow::MNU_GROUP_ROT:
|
case GraphicsWindow::MNU_GROUP_ROT:
|
||||||
g.type = ROTATE;
|
g.type = ROTATE;
|
||||||
g.opA = SS.GW.activeGroup;
|
g.opA = SS.GW.activeGroup;
|
||||||
g.exprA = Expr::FromConstant(7)->DeepCopyKeep();
|
g.exprA = Expr::FromConstant(3)->DeepCopyKeep();
|
||||||
g.subtype = ONE_SIDED;
|
g.subtype = ONE_SIDED;
|
||||||
g.name.strcpy("rotate");
|
g.name.strcpy("rotate");
|
||||||
break;
|
break;
|
||||||
|
@ -90,7 +90,7 @@ void Group::MenuGroup(int id) {
|
||||||
case GraphicsWindow::MNU_GROUP_TRANS:
|
case GraphicsWindow::MNU_GROUP_TRANS:
|
||||||
g.type = TRANSLATE;
|
g.type = TRANSLATE;
|
||||||
g.opA = SS.GW.activeGroup;
|
g.opA = SS.GW.activeGroup;
|
||||||
g.exprA = Expr::FromConstant(7)->DeepCopyKeep();
|
g.exprA = Expr::FromConstant(3)->DeepCopyKeep();
|
||||||
g.subtype = ONE_SIDED;
|
g.subtype = ONE_SIDED;
|
||||||
g.name.strcpy("translate");
|
g.name.strcpy("translate");
|
||||||
break;
|
break;
|
||||||
|
|
3
sketch.h
3
sketch.h
|
@ -83,6 +83,7 @@ public:
|
||||||
static const int EXTRUDE = 5010;
|
static const int EXTRUDE = 5010;
|
||||||
static const int ROTATE = 5020;
|
static const int ROTATE = 5020;
|
||||||
static const int TRANSLATE = 5030;
|
static const int TRANSLATE = 5030;
|
||||||
|
static const int IMPORTED = 6000;
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
hGroup opA;
|
hGroup opA;
|
||||||
|
@ -200,6 +201,7 @@ public:
|
||||||
static const int POINT_N_TRANS = 2010;
|
static const int POINT_N_TRANS = 2010;
|
||||||
static const int POINT_N_ROT_TRANS = 2011;
|
static const int POINT_N_ROT_TRANS = 2011;
|
||||||
static const int POINT_N_COPY = 2012;
|
static const int POINT_N_COPY = 2012;
|
||||||
|
static const int POINT_N_ROT_AA = 2013;
|
||||||
|
|
||||||
static const int NORMAL_IN_3D = 3000;
|
static const int NORMAL_IN_3D = 3000;
|
||||||
static const int NORMAL_IN_2D = 3001;
|
static const int NORMAL_IN_2D = 3001;
|
||||||
|
@ -211,6 +213,7 @@ public:
|
||||||
static const int NORMAL_IN_PLANE = 3002;
|
static const int NORMAL_IN_PLANE = 3002;
|
||||||
static const int NORMAL_N_COPY = 3010;
|
static const int NORMAL_N_COPY = 3010;
|
||||||
static const int NORMAL_N_ROT = 3011;
|
static const int NORMAL_N_ROT = 3011;
|
||||||
|
static const int NORMAL_N_ROT_AA = 3012;
|
||||||
|
|
||||||
static const int DISTANCE = 4000;
|
static const int DISTANCE = 4000;
|
||||||
static const int DISTANCE_N_COPY = 4001;
|
static const int DISTANCE_N_COPY = 4001;
|
||||||
|
|
42
textwin.cpp
42
textwin.cpp
|
@ -400,17 +400,21 @@ void TextWindow::ScreenChangeExprA(int link, DWORD v) {
|
||||||
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) {
|
||||||
|
Group *g = SS.GetGroup(SS.TW.shown->group);
|
||||||
|
ShowTextEditControl(7, 13, g->DescriptionString()+5);
|
||||||
|
SS.TW.edit.meaning = EDIT_GROUP_NAME;
|
||||||
|
SS.TW.edit.group.v = v;
|
||||||
|
}
|
||||||
void TextWindow::ShowGroupInfo(void) {
|
void TextWindow::ShowGroupInfo(void) {
|
||||||
Group *g = SS.group.FindById(shown->group);
|
Group *g = SS.group.FindById(shown->group);
|
||||||
char *s, *s2;
|
char *s, *s2;
|
||||||
if(SS.GW.activeGroup.v == shown->group.v) {
|
|
||||||
s = "active ";
|
s = (shown->group.v == Group::HGROUP_REFERENCES.v) ? "" : "(rename)";
|
||||||
} else if(shown->group.v == Group::HGROUP_REFERENCES.v) {
|
|
||||||
s = "special ";
|
Printf(true, "%FtGROUP %E%s %Fl%Ll%D%f%s%E",
|
||||||
} else {
|
g->DescriptionString(),
|
||||||
s = "";
|
g->h.v, &TextWindow::ScreenChangeGroupName, s);
|
||||||
}
|
|
||||||
Printf(true, "%Ft%sGROUP %E%s", s, g->DescriptionString());
|
|
||||||
|
|
||||||
if(g->type == Group::EXTRUDE) {
|
if(g->type == Group::EXTRUDE) {
|
||||||
s = "EXTRUDE";
|
s = "EXTRUDE";
|
||||||
|
@ -431,13 +435,12 @@ void TextWindow::ShowGroupInfo(void) {
|
||||||
(one ? "" : "one side"), (one ? "one side" : ""),
|
(one ? "" : "one side"), (one ? "one side" : ""),
|
||||||
&TextWindow::ScreenChangeOneOrTwoSides,
|
&TextWindow::ScreenChangeOneOrTwoSides,
|
||||||
(!one ? "" : "two sides"), (!one ? "two sides" : ""));
|
(!one ? "" : "two sides"), (!one ? "two sides" : ""));
|
||||||
|
|
||||||
}
|
}
|
||||||
if(g->type == Group::ROTATE || g->type == Group::TRANSLATE) {
|
if(g->type == Group::ROTATE || g->type == Group::TRANSLATE) {
|
||||||
int times = (int)(g->exprA->Eval());
|
int times = (int)(g->exprA->Eval());
|
||||||
Printf(true, "%Ft%s%E %d time%s %Fl%Ll%D%f(change)%E",
|
Printf(true, "%Ft%s%E %d time%s %Fl%Ll%D%f(change)%E",
|
||||||
s2, times, times == 1 ? "" : "s",
|
s2, times, times == 1 ? "" : "s",
|
||||||
g->h, &TextWindow::ScreenChangeExprA);
|
g->h.v, &TextWindow::ScreenChangeExprA);
|
||||||
}
|
}
|
||||||
if(g->type == Group::EXTRUDE) {
|
if(g->type == Group::EXTRUDE) {
|
||||||
bool diff = (g->meshCombine == Group::COMBINE_AS_DIFFERENCE);
|
bool diff = (g->meshCombine == Group::COMBINE_AS_DIFFERENCE);
|
||||||
|
@ -532,7 +535,6 @@ void TextWindow::ShowConstraintInfo(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextWindow::EditControlDone(char *s) {
|
void TextWindow::EditControlDone(char *s) {
|
||||||
HideTextEditControl();
|
|
||||||
switch(edit.meaning) {
|
switch(edit.meaning) {
|
||||||
case EDIT_TIMES_REPEATED: {
|
case EDIT_TIMES_REPEATED: {
|
||||||
Expr *e = Expr::FromString(s);
|
Expr *e = Expr::FromString(s);
|
||||||
|
@ -547,7 +549,25 @@ void TextWindow::EditControlDone(char *s) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case EDIT_GROUP_NAME: {
|
||||||
|
char *t;
|
||||||
|
bool invalid = false;
|
||||||
|
for(t = s; *t; t++) {
|
||||||
|
if(!(isalnum(*t) || *t == '-' || *t == '_')) {
|
||||||
|
invalid = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(invalid || !*s) {
|
||||||
|
Error("Invalid characters. Allowed are: A-Z a-z 0-9 _ -");
|
||||||
|
} else {
|
||||||
|
Group *g = SS.GetGroup(edit.group);
|
||||||
|
g->name.strcpy(s);
|
||||||
|
}
|
||||||
|
SS.TW.Show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HideTextEditControl();
|
||||||
edit.meaning = EDIT_NOTHING;
|
edit.meaning = EDIT_NOTHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
ui.h
4
ui.h
|
@ -57,6 +57,7 @@ public:
|
||||||
|
|
||||||
static const int EDIT_NOTHING = 0;
|
static const int EDIT_NOTHING = 0;
|
||||||
static const int EDIT_TIMES_REPEATED = 1;
|
static const int EDIT_TIMES_REPEATED = 1;
|
||||||
|
static const int EDIT_GROUP_NAME = 2;
|
||||||
struct {
|
struct {
|
||||||
int meaning;
|
int meaning;
|
||||||
hGroup group;
|
hGroup group;
|
||||||
|
@ -90,7 +91,10 @@ public:
|
||||||
|
|
||||||
static void ScreenChangeOneOrTwoSides(int link, DWORD v);
|
static void ScreenChangeOneOrTwoSides(int link, DWORD v);
|
||||||
static void ScreenChangeMeshCombine(int link, DWORD v);
|
static void ScreenChangeMeshCombine(int link, DWORD v);
|
||||||
|
|
||||||
|
// These ones do stuff with the edit control
|
||||||
static void ScreenChangeExprA(int link, DWORD v);
|
static void ScreenChangeExprA(int link, DWORD v);
|
||||||
|
static void ScreenChangeGroupName(int link, DWORD v);
|
||||||
|
|
||||||
static void ScreenNavigation(int link, DWORD v);
|
static void ScreenNavigation(int link, DWORD v);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user