From f7f73bc900ad46d296780d5187daa74006ed1b4d Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Tue, 29 Sep 2009 04:31:07 -0800 Subject: [PATCH] Change the unregistered behavior: instead of limiting the number of constraints, print a message in anything that we export. [git-p4: depot-paths = "//depot/solvespace/": change = 2038] --- constraint.cpp | 15 --------------- export.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/constraint.cpp b/constraint.cpp index 0fae97b..ee70440 100644 --- a/constraint.cpp +++ b/constraint.cpp @@ -103,21 +103,6 @@ void Constraint::ConstrainCoincident(hEntity ptA, hEntity ptB) { } void Constraint::MenuConstrain(int id) { - int nt = 0; - Constraint *ct; - for(ct = SK.constraint.First(); ct; ct = SK.constraint.NextAfter(ct)) { - if(ct->type != POINTS_COINCIDENT) nt++; - } - if(nt > 25) { - if((!SS.license.licensed) && SS.license.trialDaysRemaining <= 0) { - Error("The 90-day trial of SolveSpace has expired, and the light " - "version does not support more than 25 constraints in a " - "single file.\r\n\r\n" - "Choose Help -> Website / Manual to purchase a license."); - return; - } - } - Constraint c; ZERO(&c); c.group = SS.GW.activeGroup; diff --git a/export.cpp b/export.cpp index 998ff99..8a872b3 100644 --- a/export.cpp +++ b/export.cpp @@ -369,6 +369,12 @@ VectorFileWriter *VectorFileWriter::ForFile(char *filename) { return ret; } +static void AddUnregMessageCallback(void *fndata, Vector a, Vector b) +{ + SEdgeList *sel = (SEdgeList *)fndata; + sel->AddEdge(a, b, Style::SELECTED); +} + void VectorFileWriter::Output(SEdgeList *sel, SBezierList *sbl, SMesh *sm) { STriangle *tr; SEdge *e; @@ -415,6 +421,38 @@ void VectorFileWriter::Output(SEdgeList *sel, SBezierList *sbl, SMesh *sm) { ptMax.y = ptMin.y + (s*SS.exportCanvas.height); } + // If the demo period has expired and there's no license, then print + // a message in any exported file. + if((!SS.license.licensed) && (SS.license.trialDaysRemaining <= 0)) { + char *str = + "eval / nonprofit use only -- buy at http://solvespace.com/"; + double aspect = (glxStrWidth(str, 1) / glxStrHeight(1)); + double w = ptMax.x - ptMin.x, h = ptMax.y - ptMin.y; + Vector u, v, t; + double th; + if(w > h) { + th = w / aspect; + u = Vector::From(1, 0, 0); + v = Vector::From(0, 1, 0); + t = Vector::From(ptMin.x + (w/2), ptMin.y - 1.5*th, 0); + } else { + th = h / aspect; + u = Vector::From( 0, 1, 0); + v = Vector::From(-1, 0, 0); + t = Vector::From(ptMax.x + 1.5*th, ptMin.y + (h/2) , 0); + } + glxWriteTextRefCenter( + str, + 0.9 * th * SS.GW.scale, + t, u, v, + AddUnregMessageCallback, sel); + if(w > h) { + ptMin.y -= th*3; + } else { + ptMax.x += th*3; + } + } + StartFile(); if(sm && SS.exportShadedTriangles) { for(tr = sm->l.First(); tr; tr = sm->l.NextAfter(tr)) {