+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/
#include "support/lyxlib.h" // for float_equal
#include "support/lstrings.h"
+#include "support/tostr.h"
#include "debug.h"
namespace lyx {
using support::float_equal;
+using support::strToDbl;
using support::token;
namespace frontend {
}
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);
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];
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);
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 {
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()) {
+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/
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
dialog_->aspectratio->setChecked(igp.keepAspectRatio);
- dialog_->angle->setText(toqstr(tostr(igp.rotateAngle)));
+ dialog_->angle->setText(toqstr(igp.rotateAngle));
dialog_->origin->clear();
// 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());
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 ""
+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/
// 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));
}
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) {
}
// 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);
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);
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()) {