]> git.lyx.org Git - features.git/commitdiff
Squash a warning by fixing the code.
authorAngus Leeming <leeming@lyx.org>
Thu, 29 Apr 2004 14:47:09 +0000 (14:47 +0000)
committerAngus Leeming <leeming@lyx.org>
Thu, 29 Apr 2004 14:47:09 +0000 (14:47 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8710 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/QGraphics.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormGraphics.C

index 342178c841805a079a627d0029a7309c6d30d290..848ae5cf9e4a00fdcd3bef225ec4ebb7ce87f9e4 100644 (file)
@@ -1,3 +1,8 @@
+2004-04-29  Angus Leeming  <leeming@lyx.org>
+
+       * QGraphics.C (apply): Remove a #warning statement by
+       fixing the code.
+
 2004-04-28  Angus Leeming  <leeming@lyx.org>
 
        * QLToolbar.[Ch]: rewrite code to derive from a single Toolbar or
index 6b83c675f864599839f34bbbd598e0db377a46d6..a59f7de911803b03734013096db70988e330979e 100644 (file)
@@ -373,11 +373,9 @@ void QGraphics::apply()
        igp.lyxscale = strToInt(fromqstr(dialog_->displayscale->text()));
 
        igp.rotateAngle = strToDbl(fromqstr(dialog_->angle->text()));
-#warning Guess what happens if the user enters '1e30' here?
-       while (igp.rotateAngle < -360.0)
-               igp.rotateAngle += 360.0;
-       while (igp.rotateAngle >  360.0)
-               igp.rotateAngle -= 360.0;
+
+       if (std::abs(igp.rotateAngle) > 360.0)
+               igp.rotateAngle -= 360.0 * floor(igp.rotateAngle / 360.0);
 
        // save the latex name for the origin. If it is the default
        // then origin_ltx returns ""
index 056eef90aebf484f0c5740bf0d55024375b05914..d7a35da6ae278010dbf43c7e0e6d5f0673fb3b05 100644 (file)
@@ -1,3 +1,8 @@
+2004-04-29  Angus Leeming  <leeming@lyx.org>
+
+       * FormGraphics.C (apply): don't get caught in a loop when mapping
+       the angle into -360 -> 360 degrees.
+
 2004-04-28  Angus Leeming  <leeming@lyx.org>
 
        * LayoutEngine.C (updateMetrics): respect the visible() flag when
index bf31de4c237822c319633daffdd4c34fad17419e..578971d2b3a9640a86f893689c3a284d978240b9 100644 (file)
@@ -401,12 +401,9 @@ void FormGraphics::apply()
        igp.rotateAngle = strToDbl(getString(extra_->input_rotate_angle));
 
        // map angle into -360 (clock-wise) to +360 (counter clock-wise)
-       while (igp.rotateAngle <= -360.0) {
-               igp.rotateAngle += 360.0;
-       }
-       while (igp.rotateAngle >=  360.0) {
-               igp.rotateAngle -= 360.0;
-       }
+       if (std::abs(igp.rotateAngle) > 360.0)
+               igp.rotateAngle -= 360.0 * floor(igp.rotateAngle / 360.0);
+
        fl_set_input(extra_->input_rotate_angle, tostr(igp.rotateAngle).c_str());
 
        int const origin_pos = fl_get_choice(extra_->choice_origin);