Rob Lahaye wrote:
Angus Leeming wrote:

On Sunday 27 October 2002 7:41 am, Rob Lahaye wrote:

Angus Leeming wrote:

On Thursday 24 October 2002 12:56 pm, Rob Lahaye wrote:

Now I think of it, we may better use "scale = -1" (or any
negative value) to indicate the use of width/height.
Checking "scale < 0" is safer than checking "scale == 0.0",
isn't it?

Nah. What we have is fine. If implemented correctly.

Angus,

I don't like the way "scale == 0.0" is implemented now:

        lyx::float_equal(igp.scale, 0.0, 0.05)

I still prefer using positive value for scaling, otherwise
width/height. Advantages with this are:


But it's incorrect. As I see it, these are the correct implemetations:
some_float >= 0.0
    lyx::float_equal(some_float, 0.0, 0.05) || some_float > 0.0
some_float > 0.0
    !lyx::float_equal(some_float, 0.0, 0.05) && some_float > 0.0

You are probably right that my approach was too simplistic and wrong.
But the solution you suggest here is too bizar for me. It's too much
bloat for a really simple test. Moreover, you may use "0.05" for the scale
tolerance here, and (by mistake) "0.005" in another file. You'll get
funny and difficult errors this way.

I'd then rather go the way Andre suggested: use a boolean "use_scale"
to indicate what's going on. Simple and easy to understand code.

I await if such a change is appreciated beforw the 1.3.0 release.

However, please consider to apply the attached patch to CVS, since
it fixes a real bug concerning input filters, and adds on the fly
a few more of these "lyx::float_equal(scale, ... )" beasts.
Along these lines, please consider following:


RCS file: /cvs/lyx/lyx-devel/src/insets/insetgraphicsParams.C,v
retrieving revision 1.52
diff -u -r1.52 insetgraphicsParams.C
--- src/insets/insetgraphicsParams.C	2002/10/24 11:53:46	1.52
+++ src/insets/insetgraphicsParams.C	2002/10/29 08:04:01
@@ -142,7 +142,7 @@
 		os << "\tlyxscale " << lyxscale << '\n';
 	if (display != grfx::DefaultDisplay)
 		os << "\tdisplay " << grfx::displayTranslator.find(display) << '\n';
-	if (scale) {
+	if (!lyx::float_equal(scale, 0.0, 0.05)) {
 		if (!lyx::float_equal(scale, 100.0, 0.05))
 			os << "\tscale " << scale << '\n';
 	} else {
@@ -206,9 +206,10 @@
 	} else if (token == "noUnzip") {
 		noUnzip = true;
 	} else if (token == "BoundingBox") {
-		for (int i=0; i<4 ;i++) {
+		bb.erase();
+		for (int i = 0; i < 4; ++i) {
 			lex.next();
-			bb += (lex.getString()+" ");
+			bb += lex.getString() + " ";
 		}
 	} else if (token == "clip") {
 		clip = true;



Reply via email to