]> git.lyx.org Git - features.git/commitdiff
float2string changes #1 (Graphics), missing bits
authorJürgen Spitzmüller <spitz@lyx.org>
Tue, 28 Dec 2004 11:27:51 +0000 (11:27 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Tue, 28 Dec 2004 11:27:51 +0000 (11:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9405 a592a061-630c-0410-9148-cb99ea01b6c8

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

index ac4bfac61e063410f00a3f42430474c506368f12..328392af8fb3a2afc904f3d3d17687cb77065141 100644 (file)
@@ -1,3 +1,7 @@
+2004-12-28  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * GGraphics.C: store all values as strings.
+
 2004-12-19  Angus Leeming  <leeming@lyx.org>
 
        * lyx_gui.C (start): s/slashify_path/internal_path/
index 9fba9d0b29c7999dc2848b90566324d55f5e2e9d..e62422fd10b0c1dd8c1eb839aa464ca970fdef4f 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "support/lyxlib.h"  // for float_equal
 #include "support/lstrings.h"
+#include "support/tostr.h"
 
 #include "debug.h"
 
@@ -37,6 +38,7 @@ using std::string;
 namespace lyx {
 
 using support::float_equal;
+using support::strToDbl;
 using support::token;
 
 namespace frontend {
@@ -265,12 +267,13 @@ void GGraphics::apply()
        }
 
        if (setscalingradio_->get_active()) {
-               igp.scale = outputscalespin_->get_adjustment()->get_value();
-               if (float_equal(igp.scale, 0.0, 0.05))
-                       igp.scale = 100.0;
+               float scaleValue = outputscalespin_->get_adjustment()->get_value();
+               igp.scale = tostr(scaleValue);
+               if (float_equal(scaleValue, 0.0, 0.05))
+                       igp.scale = string();
                igp.width = LyXLength();
        } else {
-               igp.scale = 0.0;
+               igp.scale = string();
                Glib::ustring const widthunit =
                        (*widthunitscombo_->get_active())[stringcol_];
                igp.width = LyXLength(widthspin_->get_text() + widthunit);
@@ -326,7 +329,7 @@ void GGraphics::apply()
        igp.clip = clipcheck_->get_active();
 
        // the extra section
-       igp.rotateAngle = anglespin_->get_adjustment()->get_value();
+       igp.rotateAngle = tostr(anglespin_->get_adjustment()->get_value());
 
        int const origin_pos = origincombo_->get_active_row_number();
        igp.rotateOrigin = origins_[origin_pos];
@@ -369,7 +372,7 @@ void GGraphics::update() {
                displaycombo_->set_active(0);
        }
 
-       outputscalespin_->get_adjustment()->set_value(igp.scale);
+       outputscalespin_->get_adjustment()->set_value(strToDbl(igp.scale));
        widthspin_->get_adjustment()->set_value(igp.width.value());
        unitsComboFromLength(widthunitscombo_, stringcol_,
                             igp.width, defaultUnit);
@@ -377,7 +380,7 @@ void GGraphics::update() {
        unitsComboFromLength(heightunitscombo_, stringcol_,
                             igp.height, defaultUnit);
 
-       if (!float_equal(igp.scale, 0.0, 0.05)) {
+       if (!igp.scale.empty() && igp.scale != "0") {
                // scaling sizing mode
                setscalingradio_->set_active(true);
        } else {
@@ -396,7 +399,7 @@ void GGraphics::update() {
        clipcheck_->set_active(igp.clip);
 
        // the extra section
-       anglespin_->get_adjustment()->set_value(igp.rotateAngle);
+       anglespin_->get_adjustment()->set_value(strToDbl(igp.rotateAngle));
 
        int origin_pos;
        if (igp.rotateOrigin.empty()) {
index 76d103119e72029eabfd15c135728f06f3b5ec8f..1065949fd82cd309c07fb498e5e052edd8a16c89 100644 (file)
@@ -1,3 +1,7 @@
+2004-12-28  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * QGraphics.C: store all values as strings.
+
 2004-12-19  Angus Leeming  <leeming@lyx.org>
 
        * lyx_gui.C (start): s/slashify_path/internal_path/
index 0a16e18801ca81d6c6b682fdffff540574f14172..836bdf203b5ab85c7ccb75ac627af9f67bcb8234 100644 (file)
@@ -256,9 +256,8 @@ void QGraphics::update_contents()
        for (int i = 0; i < num_units; i++)
                dialog_->widthUnit->insertItem(unit_name_gui[i], -1);
 
-       if (!float_equal(igp.scale, 0.0, 0.05)) {
-               // there is a scale value > 0.05
-               dialog_->width->setText(toqstr(tostr(igp.scale)));
+       if (!igp.scale.empty() && igp.scale != "0") {
+               dialog_->width->setText(toqstr(igp.scale));
                dialog_->widthUnit->setCurrentItem(0);
        } else {
                // no scale means default width/height
@@ -280,7 +279,7 @@ void QGraphics::update_contents()
 
        dialog_->aspectratio->setChecked(igp.keepAspectRatio);
 
-       dialog_->angle->setText(toqstr(tostr(igp.rotateAngle)));
+       dialog_->angle->setText(toqstr(igp.rotateAngle));
 
        dialog_->origin->clear();
 
@@ -364,10 +363,10 @@ void QGraphics::apply()
                // width/height combination
                igp.width = 
                        widgetsToLength(dialog_->width, dialog_->widthUnit);
-               igp.scale = 0.0;
+               igp.scale = string();
        } else {
                // scaling instead of a width
-               igp.scale = strToDbl(value);
+               igp.scale = value;
                igp.width = LyXLength();
        }
        value = fromqstr(dialog_->height->text());
@@ -380,10 +379,13 @@ void QGraphics::apply()
 
        igp.lyxscale = strToInt(fromqstr(dialog_->displayscale->text()));
 
-       igp.rotateAngle = strToDbl(fromqstr(dialog_->angle->text()));
+       igp.rotateAngle = fromqstr(dialog_->angle->text());
 
-       if (std::abs(igp.rotateAngle) > 360.0)
-               igp.rotateAngle -= 360.0 * floor(igp.rotateAngle / 360.0);
+       float rotAngle = strToDbl(igp.rotateAngle);
+       if (std::abs(rotAngle) > 360.0) {
+               rotAngle -= 360.0 * floor(rotAngle / 360.0);
+               igp.rotateAngle = tostr(rotAngle);
+       }
 
        // save the latex name for the origin. If it is the default
        // then origin_ltx returns ""
index 25f2ef7e2b9fb6737788f52dbd2e70f568178e5f..64a16a188e0b8c967b497ba5a00d1023bffee22e 100644 (file)
@@ -1,3 +1,7 @@
+2004-12-28  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * FormGraphics.C: store all values as strings.
+
 2004-12-19  Angus Leeming  <leeming@lyx.org>
 
        * lyx_gui.C (start): s/slashify_path/internal_path/
index 026676d19438b6cda9bab2c9e0867ceb6490206f..3ce01d793f4b881028e1d3556a08100cc89e9d2c 100644 (file)
@@ -330,13 +330,13 @@ void FormGraphics::apply()
 
        // first item in choice_width means scaling
        if (fl_get_choice(file_->choice_width) == 1) {
-               igp.scale = strToDbl(getString(file_->input_width));
-               if (float_equal(igp.scale, 0.0, 0.05)) {
-                       igp.scale = 100.0;
+               igp.scale = getString(file_->input_width);
+               if (igp.scale.empty() || igp.scale == "0" || igp.scale == "100") {
+                       igp.scale = string();
                }
                igp.width = LyXLength();
        } else {
-               igp.scale = 0.0;
+               igp.scale = string();
                igp.width = LyXLength(getLengthFromWidgets(file_->input_width,
                                                           file_->choice_width));
        }
@@ -406,13 +406,16 @@ void FormGraphics::apply()
        igp.clip = fl_get_button(bbox_->check_clip);
 
        // the extra section
-       igp.rotateAngle = strToDbl(getString(extra_->input_rotate_angle));
+       igp.rotateAngle = getString(extra_->input_rotate_angle);
 
        // map angle into -360 (clock-wise) to +360 (counter clock-wise)
-       if (std::abs(igp.rotateAngle) > 360.0)
-               igp.rotateAngle -= 360.0 * floor(igp.rotateAngle / 360.0);
+       float rotAngle = strToDbl(igp.rotateAngle);
+       if (std::abs(rotAngle) > 360.0) {
+                rotAngle -= 360.0 * floor(rotAngle / 360.0);
+                igp.rotateAngle = tostr(rotAngle);
+       }
 
-       fl_set_input(extra_->input_rotate_angle, tostr(igp.rotateAngle).c_str());
+       fl_set_input(extra_->input_rotate_angle, igp.rotateAngle.c_str());
 
        int const origin_pos = fl_get_choice(extra_->choice_origin);
        if (origin_pos == 0) {
@@ -456,10 +459,10 @@ void FormGraphics::update() {
        }
 
        // set width input fields according to scaling or width/height input
-       if (!float_equal(igp.scale, 0.0, 0.05)) {
+       if (!igp.scale.empty() && igp.scale != "0") {
                fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
                fl_set_input_maxchars(file_->input_width, 0);
-               fl_set_input(file_->input_width, tostr(igp.scale).c_str());
+               fl_set_input(file_->input_width, igp.scale.c_str());
                fl_set_choice(file_->choice_width, 1);
        } else {
                fl_set_input_filter(file_->input_width, NULL);
@@ -472,7 +475,7 @@ void FormGraphics::update() {
                                igp.height, defaultUnit);
 
        // disable height input in case of scaling
-       bool const disable_height = !float_equal(igp.scale, 0.0, 0.05);
+       bool const disable_height = (!igp.scale.empty() && igp.scale != "0");
        setEnabled(file_->input_height, !disable_height);
        setEnabled(file_->choice_height, !disable_height);
 
@@ -494,8 +497,7 @@ void FormGraphics::update() {
        fl_set_button(bbox_->check_clip, igp.clip);
 
        // the extra section
-       fl_set_input(extra_->input_rotate_angle,
-                    tostr(igp.rotateAngle).c_str());
+       fl_set_input(extra_->input_rotate_angle, igp.rotateAngle.c_str());
 
        int origin_pos;
        if (igp.rotateOrigin.empty()) {