diff --git a/generate.cpp b/generate.cpp index 8cd103eb..c86a7739 100644 --- a/generate.cpp +++ b/generate.cpp @@ -170,9 +170,59 @@ void SolveSpace::GenerateAll(int first, int last, bool andFindFree) { SK.param.MoveSelfInto(&prev); SK.entity.Clear(); + SDWORD inTime = GetMilliseconds(); + + bool displayedStatusMessage = false; for(i = 0; i < SK.group.n; i++) { Group *g = &(SK.group.elem[i]); + SDWORD now = GetMilliseconds(); + // Display the status message if we've taken more than 400 ms, or + // if we've taken 200 ms but we're not even halfway done, or if + // we've already started displaying the status message. + if( (now - inTime > 400) || + ((now - inTime > 200) && i < (SK.group.n / 2)) || + displayedStatusMessage) + { + displayedStatusMessage = true; + char msg[1024]; + sprintf(msg, "generating group %d/%d", i, SK.group.n); + + int w, h; + GetGraphicsWindowSize(&w, &h); + glDrawBuffer(GL_FRONT); + glViewport(0, 0, w, h); + glLoadIdentity(); + glTranslated(-1, 1, 0); + glScaled(2.0/w, 2.0/h, 1.0); + glDisable(GL_DEPTH_TEST); + + double left = 80, top = -20, width = 240, height = 24; + glColor3d(0.9, 0.8, 0.8); + glBegin(GL_QUADS); + glVertex2d(left, top); + glVertex2d(left+width, top); + glVertex2d(left+width, top-height); + glVertex2d(left, top-height); + glEnd(); + glLineWidth(1); + glColor3d(0.0, 0.0, 0.0); + glBegin(GL_LINE_LOOP); + glVertex2d(left, top); + glVertex2d(left+width, top); + glVertex2d(left+width, top-height); + glVertex2d(left, top-height); + glEnd(); + + glColor3d(0, 0, 0); + glPushMatrix(); + glRasterPos2d(left+8, top-17); + DrawWithBitmapFont(msg); + glPopMatrix(); + glFlush(); + glDrawBuffer(GL_BACK); + } + // The group may depend on entities or other groups, to define its // workplane geometry or for its operands. Those must already exist // in a previous group, so check them before generating. diff --git a/group.cpp b/group.cpp index fec6a92a..b3f2d69e 100644 --- a/group.cpp +++ b/group.cpp @@ -734,7 +734,12 @@ void Group::CopyEntity(IdList *el, default: oops(); } - en.forceHidden = !ep->actVisible; + + // If the entity came from an imported file where it was invisible then + // ep->actiVisble will be false, and we should hide it. Or if the entity + // came from a copy (e.g. step and repeat) of a force-hidden imported + // entity, then we also want to hide it. + en.forceHidden = (!ep->actVisible) || ep->forceHidden; el->Add(&en); } diff --git a/groupmesh.cpp b/groupmesh.cpp index 7663769f..aff4ab03 100644 --- a/groupmesh.cpp +++ b/groupmesh.cpp @@ -11,6 +11,7 @@ bool Group::AssembleLoops(void) { Entity *e = &(SK.entity.elem[i]); if(e->group.v != h.v) continue; if(e->construction) continue; + if(e->forceHidden) continue; e->GenerateBezierCurves(&sbl); } diff --git a/solvespace.cpp b/solvespace.cpp index a51242af..4ed1188e 100644 --- a/solvespace.cpp +++ b/solvespace.cpp @@ -65,7 +65,7 @@ void SolveSpace::Init(char *cmdLine) { // Camera tangent (determines perspective) cameraTangent = CnfThawFloat(0.0f, "CameraTangent"); // Color for edges (drawn as lines for emphasis) - edgeColor = CnfThawDWORD(RGB(0, 0, 0), "EdgeColor"); + edgeColor = CnfThawDWORD(RGB(200, 200, 200), "EdgeColor"); // Export scale factor exportScale = CnfThawFloat(1.0f, "ExportScale"); // Export offset (cutter radius comp) @@ -715,10 +715,10 @@ void SolveSpace::MenuHelp(int id) { break; case GraphicsWindow::MNU_ABOUT: - Message("This is SolveSpace version 1.3.\r\n\r\n" - "For more information, see http://www.solvespace.com/\r\n\r\n" - "Built " __TIME__ " " __DATE__ ".\r\n\r\n" - "Copyright 2008 Jonathan Westhues, All Rights Reserved."); + Message("This is SolveSpace version 1.4.\r\n\r\n" + "For more information, see http://www.solvespace.com/\r\n\r\n" + "Built " __TIME__ " " __DATE__ ".\r\n\r\n" + "Copyright 2008-2009 Jonathan Westhues, All Rights Reserved."); break; case GraphicsWindow::MNU_LICENSE: { diff --git a/win32/w32main.cpp b/win32/w32main.cpp index 6ad5c3e3..837e0d0b 100644 --- a/win32/w32main.cpp +++ b/win32/w32main.cpp @@ -976,7 +976,7 @@ static void CreateMainWindows(void) HMENU top = CreateGraphicsWindowMenus(); GraphicsWnd = CreateWindowEx(0, "GraphicsWnd", - "SolveSpace (Graphics Window)", + "SolveSpace (not yet saved)", WS_OVERLAPPED | WS_THICKFRAME | WS_CLIPCHILDREN | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX | WS_CLIPSIBLINGS, 50, 50, 900, 600, NULL, top, Instance, NULL); @@ -1053,6 +1053,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, ThawWindowPos(TextWnd); ThawWindowPos(GraphicsWnd); + ShowWindow(TextWnd, SW_SHOWNOACTIVATE); + ShowWindow(GraphicsWnd, SW_SHOW); + + glClearColor(0, 0, 0, 1); + glClear(GL_COLOR_BUFFER_BIT); + SwapBuffers(GetDC(GraphicsWnd)); + glClearColor(0, 0, 0, 1); + glClear(GL_COLOR_BUFFER_BIT); + SwapBuffers(GetDC(GraphicsWnd)); + // Create the heaps for all dynamic memory (AllocTemporary, MemAlloc) InitHeaps(); @@ -1073,9 +1083,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, // Call in to the platform-independent code, and let them do their init SS.Init(file); - ShowWindow(TextWnd, SW_SHOWNOACTIVATE); - ShowWindow(GraphicsWnd, SW_SHOW); - // And now it's the message loop. All calls in to the rest of the code // will be from the wndprocs. MSG msg; diff --git a/wishlist.txt b/wishlist.txt index b403b80d..5e01eef3 100644 --- a/wishlist.txt +++ b/wishlist.txt @@ -1,12 +1,10 @@ -tangent intersections -plane detection for solid of revolution ----- line styles (color, thickness) marching algorithm for surface intersection loop detection -IGES and STEP export -incremental regen of entities? +IGES export +incremental regen of entities