Get rid of the MAX_SELECTED restriction in GroupSelection().

This commit is contained in:
whitequark 2016-08-13 05:20:43 +00:00
parent ca150aeda1
commit dc0eed8322
3 changed files with 22 additions and 15 deletions

View File

@ -19,6 +19,7 @@ Bug fixes:
* Fix TTF font metrics (restore the behavior from version 2.0).
* Forcibly show the current group once we start a drawing operation.
* DXF export: always declare layers before using them.
* Do not truncate operations on selections to first 32 selected entities.
2.1
---

View File

@ -249,7 +249,7 @@ void GraphicsWindow::SelectByMarquee(void) {
void GraphicsWindow::GroupSelection(void) {
gs = {};
int i;
for(i = 0; i < selection.n && i < MAX_SELECTED; i++) {
for(i = 0; i < selection.n; i++) {
Selection *s = &(selection.elem[i]);
if(s->entity.v) {
(gs.n)++;
@ -260,27 +260,33 @@ void GraphicsWindow::GroupSelection(void) {
// A list of points, and a list of all entities that aren't points.
if(e->IsPoint()) {
gs.point[(gs.points)++] = s->entity;
gs.points++;
gs.point.push_back(s->entity);
} else {
gs.entity[(gs.entities)++] = s->entity;
gs.entities++;
gs.entity.push_back(s->entity);
}
// And an auxiliary list of normals, including normals from
// workplanes.
if(e->IsNormal()) {
gs.anyNormal[(gs.anyNormals)++] = s->entity;
gs.anyNormals++;
gs.anyNormal.push_back(s->entity);
} else if(e->IsWorkplane()) {
gs.anyNormal[(gs.anyNormals)++] = e->Normal()->h;
gs.anyNormals++;
gs.anyNormal.push_back(e->Normal()->h);
}
// And of vectors (i.e., stuff with a direction to constrain)
if(e->HasVector()) {
gs.vector[(gs.vectors)++] = s->entity;
gs.vectors++;
gs.vector.push_back(s->entity);
}
// Faces (which are special, associated/drawn with triangles)
if(e->IsFace()) {
gs.face[(gs.faces)++] = s->entity;
gs.faces++;
gs.face.push_back(s->entity);
}
if(e->HasEndpoints()) {
@ -303,7 +309,8 @@ void GraphicsWindow::GroupSelection(void) {
}
}
if(s->constraint.v) {
gs.constraint[(gs.constraints)++] = s->constraint;
gs.constraints++;
gs.constraint.push_back(s->constraint);
Constraint *c = SK.GetConstraint(s->constraint);
if(c->IsStylable()) gs.stylables++;
if(c->HasLabel()) gs.constraintLabels++;

View File

@ -629,14 +629,13 @@ public:
void HitTestMakeSelection(Point2d mp);
void ClearSelection(void);
void ClearNonexistentSelectionItems(void);
enum { MAX_SELECTED = 32 };
struct {
hEntity point[MAX_SELECTED];
hEntity entity[MAX_SELECTED];
hEntity anyNormal[MAX_SELECTED];
hEntity vector[MAX_SELECTED];
hEntity face[MAX_SELECTED];
hConstraint constraint[MAX_SELECTED];
std::vector<hEntity> point;
std::vector<hEntity> entity;
std::vector<hEntity> anyNormal;
std::vector<hEntity> vector;
std::vector<hEntity> face;
std::vector<hConstraint> constraint;
int points;
int entities;
int workplanes;