From 3b4aa2c2b257d2c55993bd23092efaa994fca3cf Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Sat, 14 Jun 2008 15:31:36 -0800 Subject: [PATCH] Little fixes for units display, and change file format to binary (even though it's still a text file), to avoid CRLF issue. [git-p4: depot-paths = "//depot/solvespace/": change = 1794] --- draw.cpp | 1 + file.cpp | 8 ++++---- graphicswin.cpp | 11 ++++------- wishlist.txt | 2 -- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/draw.cpp b/draw.cpp index fbb7a1b..5c67548 100644 --- a/draw.cpp +++ b/draw.cpp @@ -851,6 +851,7 @@ void GraphicsWindow::Paint(int w, int h) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); + glEnable(GL_POLYGON_SMOOTH); glEnable(GL_POLYGON_OFFSET_LINE); glEnable(GL_POLYGON_OFFSET_FILL); glEnable(GL_DEPTH_TEST); diff --git a/file.cpp b/file.cpp index ccd6204..98c3c0a 100644 --- a/file.cpp +++ b/file.cpp @@ -179,7 +179,7 @@ bool SolveSpace::SaveToFile(char *filename) { // will be exported. SS.GenerateAll(0, INT_MAX); - fh = fopen(filename, "w"); + fh = fopen(filename, "wb"); if(!fh) { Error("Couldn't write to file '%s'", filename); return false; @@ -281,7 +281,7 @@ void SolveSpace::LoadUsingTable(char *key, char *val) { } bool SolveSpace::LoadFromFile(char *filename) { - fh = fopen(filename, "r"); + fh = fopen(filename, "rb"); if(!fh) { Error("Couldn't read from file '%s'", filename); return false; @@ -340,7 +340,7 @@ bool SolveSpace::LoadFromFile(char *filename) { } bool SolveSpace::LoadEntitiesFromFile(char *file, EntityList *le, SMesh *m) { - fh = fopen(file, "r"); + fh = fopen(file, "rb"); if(!fh) return false; le->Clear(); @@ -403,7 +403,7 @@ void SolveSpace::ReloadAllImported(void) { g->impEntity.Clear(); g->impMesh.Clear(); if(!LoadEntitiesFromFile(g->impFile, &(g->impEntity), &(g->impMesh))) { - oops(); + Error("Failed to load imported file '%s'", g->impFile); } } } diff --git a/graphicswin.cpp b/graphicswin.cpp index bfe97ae..042c147 100644 --- a/graphicswin.cpp +++ b/graphicswin.cpp @@ -98,13 +98,8 @@ void GraphicsWindow::Init(void) { projRight = Vector::From(1, 0, 0); projUp = Vector::From(0, 1, 0); - // And with the latest visible group active, or failing that the first - // group after the references - int i; - for(i = 0; i < SS.group.n; i++) { - Group *g = &(SS.group.elem[i]); - if(i == 1 || g->visible) activeGroup = g->h; - } + // And with the last group active + activeGroup = SS.group.elem[SS.group.n-1].h; SS.GetGroup(activeGroup)->Activate(); showWorkplanes = false; @@ -259,11 +254,13 @@ void GraphicsWindow::MenuView(int id) { case MNU_UNITS_MM: SS.viewUnits = SolveSpace::UNIT_MM; + SS.later.showTW = true; SS.GW.EnsureValidActives(); break; case MNU_UNITS_INCHES: SS.viewUnits = SolveSpace::UNIT_INCHES; + SS.later.showTW = true; SS.GW.EnsureValidActives(); break; diff --git a/wishlist.txt b/wishlist.txt index 332383c..8ebc156 100644 --- a/wishlist.txt +++ b/wishlist.txt @@ -5,13 +5,11 @@ DXF export TTF font text some kind of rounding / chamfer remove back button in browser? -clean up user-created workplanes graphic export relative paths for import auto-generate circles and faces when lathing partitioned subsystems in the solver -display with proper formatting/units sweep tool