GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use an enum to select the mode of operation for GenerateAll. · realthunder/solvespace@b28fa34

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • clipboard.cpp
    • confscreen.cpp
    • file.cpp
    • generate.cpp
    • graphicswin.cpp
    • mouse.cpp
    • solvespace.cpp
    • solvespace.h
    • textscreens.cpp
    • undoredo.cpp
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/clipboard.cpp‎

Copy file name to clipboardExpand all lines: src/clipboard.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) {
150150
r->construction = cr->construction;
151151
// Need to regen to get the right number of points, if extraPoints
152152
// changed.
153-
SS.GenerateAll(-1, -1);
153+
SS.GenerateAll(SolveSpaceUI::GENERATE_REGEN);
154154
SS.MarkGroupDirty(r->group);
155155
bool hasDistance;
156156
int i, pts;
Collapse file

‎src/confscreen.cpp‎

Copy file name to clipboardExpand all lines: src/confscreen.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,12 @@ bool TextWindow::EditControlDoneForConfiguration(const char *s) {
313313
}
314314
case EDIT_CHORD_TOLERANCE: {
315315
SS.chordTol = min(10.0, max(0.1, atof(s)));
316-
SS.GenerateAll(0, INT_MAX);
316+
SS.GenerateAll(SolveSpaceUI::GENERATE_ALL);
317317
break;
318318
}
319319
case EDIT_MAX_SEGMENTS: {
320320
SS.maxSegments = min(1000, max(7, atoi(s)));
321-
SS.GenerateAll(0, INT_MAX);
321+
SS.GenerateAll(SolveSpaceUI::GENERATE_ALL);
322322
break;
323323
}
324324
case EDIT_CAMERA_TANGENT: {
Collapse file

‎src/file.cpp‎

Copy file name to clipboardExpand all lines: src/file.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ bool SolveSpaceUI::SaveToFile(const std::string &filename) {
255255
// the impFileRel for our possibly-new filename.
256256
SS.ScheduleShowTW();
257257
SS.ReloadAllImported();
258-
SS.GenerateAll(0, INT_MAX);
258+
SS.GenerateAll(SolveSpaceUI::GENERATE_ALL);
259259

260260
fh = ssfopen(filename, "wb");
261261
if(!fh) {
Collapse file

‎src/generate.cpp‎

Copy file name to clipboardExpand all lines: src/generate.cpp
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,22 @@ void SolveSpaceUI::GenerateAll(void) {
158158
}
159159
if(firstDirty == INT_MAX || lastVisible == 0) {
160160
// All clean; so just regenerate the entities, and don't solve anything.
161-
GenerateAll(-1, -1);
161+
GenerateAll(GENERATE_REGEN);
162162
} else {
163163
SS.nakedEdges.Clear();
164164
GenerateAll(firstDirty, lastVisible);
165165
}
166166
}
167167

168+
void SolveSpaceUI::GenerateAll(GenerateType type, bool andFindFree) {
169+
switch(type) {
170+
case GENERATE_ALL: GenerateAll(0, INT_MAX, andFindFree); break;
171+
case GENERATE_REGEN: GenerateAll(-1, -1, andFindFree); break;
172+
case GENERATE_UNTIL_ACTIVE: GenerateAll(0, -2, andFindFree); break;
173+
default: oops();
174+
}
175+
}
176+
168177
void SolveSpaceUI::GenerateAll(int first, int last, bool andFindFree) {
169178
int i, j;
170179

Collapse file

‎src/graphicswin.cpp‎

Copy file name to clipboardExpand all lines: src/graphicswin.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ void GraphicsWindow::DeleteTaggedRequests(void) {
678678
ClearSuper();
679679
// And regenerate to get rid of what it generates, plus anything
680680
// that references it (since the regen code checks for that).
681-
SS.GenerateAll(0, INT_MAX);
681+
SS.GenerateAll(SolveSpaceUI::GENERATE_ALL);
682682
EnsureValidActives();
683683
SS.ScheduleShowTW();
684684
}
@@ -886,7 +886,7 @@ void GraphicsWindow::MenuEdit(int id) {
886886

887887
case MNU_REGEN_ALL:
888888
SS.ReloadAllImported();
889-
SS.GenerateAll(0, -2);
889+
SS.GenerateAll(SolveSpaceUI::GENERATE_UNTIL_ACTIVE);
890890
SS.ScheduleShowTW();
891891
break;
892892

Collapse file

‎src/mouse.cpp‎

Copy file name to clipboardExpand all lines: src/mouse.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ hRequest GraphicsWindow::AddRequest(int type, bool rememberForUndo) {
743743
// place this request's entities where the mouse is can do so. But
744744
// we mustn't try to solve until reasonable values have been supplied
745745
// for these new parameters, or else we'll get a numerical blowup.
746-
SS.GenerateAll(-1, -1);
746+
SS.GenerateAll(SolveSpaceUI::GENERATE_REGEN);
747747
SS.MarkGroupDirty(r.group);
748748
return r.h;
749749
}
@@ -1006,7 +1006,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
10061006
}
10071007

10081008
(SK.GetRequest(hr)->extraPoints)++;
1009-
SS.GenerateAll(-1, -1);
1009+
SS.GenerateAll(SolveSpaceUI::GENERATE_REGEN);
10101010

10111011
int ep = r->extraPoints;
10121012
Vector last = SK.GetEntity(hr.entity(3+ep))->PointGetNum();
Collapse file

‎src/solvespace.cpp‎

Copy file name to clipboardExpand all lines: src/solvespace.cpp
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void SolveSpaceUI::AfterNewFile(void) {
294294
SS.GW.projRight = Vector::From(1, 0, 0);
295295
SS.GW.projUp = Vector::From(0, 1, 0);
296296

297-
GenerateAll(-1, -1);
297+
GenerateAll(GENERATE_REGEN);
298298

299299
TW.Init();
300300
GW.Init();
@@ -312,7 +312,7 @@ void SolveSpaceUI::AfterNewFile(void) {
312312
// thing visible is the not-yet-generated surfaces.
313313
GW.ZoomToFit(true);
314314

315-
GenerateAll(0, INT_MAX);
315+
GenerateAll(GENERATE_ALL);
316316
SS.ScheduleShowTW();
317317
// Then zoom to fit again, to fit the triangles
318318
GW.ZoomToFit(false);
@@ -713,7 +713,7 @@ void SolveSpaceUI::MenuAnalyze(int id) {
713713
case GraphicsWindow::MNU_SHOW_DOF:
714714
// This works like a normal solve, except that it calculates
715715
// which variables are free/bound at the same time.
716-
SS.GenerateAll(0, INT_MAX, true);
716+
SS.GenerateAll(SolveSpaceUI::GENERATE_ALL, true);
717717
break;
718718

719719
case GraphicsWindow::MNU_TRACE_PT:
Collapse file

‎src/solvespace.h‎

Copy file name to clipboardExpand all lines: src/solvespace.h
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,13 @@ class SolveSpaceUI {
926926
bool PruneRequests(hGroup hg);
927927
bool PruneConstraints(hGroup hg);
928928

929+
enum GenerateType {
930+
GENERATE_ALL,
931+
GENERATE_REGEN,
932+
GENERATE_UNTIL_ACTIVE,
933+
};
934+
935+
void GenerateAll(GenerateType type, bool andFindFree = false);
929936
void GenerateAll(void);
930937
void GenerateAll(int first, int last, bool andFindFree=false);
931938
void SolveGroup(hGroup hg, bool andFindFree);
Collapse file

‎src/textscreens.cpp‎

Copy file name to clipboardExpand all lines: src/textscreens.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ void TextWindow::ScreenDeleteGroup(int link, uint32_t v) {
266266
// This is a major change, so let's re-solve everything.
267267
SS.TW.ClearSuper();
268268
SS.GW.ClearSuper();
269-
SS.GenerateAll(0, INT_MAX);
269+
SS.GenerateAll(SolveSpaceUI::GENERATE_ALL);
270270
}
271271
void TextWindow::ShowGroupInfo(void) {
272272
Group *g = SK.group.FindById(shown.group);
Collapse file

‎src/undoredo.cpp‎

Copy file name to clipboardExpand all lines: src/undoredo.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void SolveSpaceUI::PopOntoCurrentFrom(UndoStack *uk) {
127127
SS.GW.ClearSuper();
128128
SS.TW.ClearSuper();
129129
SS.ReloadAllImported();
130-
SS.GenerateAll(0, INT_MAX);
130+
SS.GenerateAll(SolveSpaceUI::GENERATE_ALL);
131131
SS.ScheduleShowTW();
132132

133133
// Activate the group that was active before.

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.