#include "support/lstrings.h" // for strToDbl & tostr
#include "support/FileInfo.h" // for FileInfo
#include "insets/insetgraphicsParams.h"
+#include "lyxrc.h" // for lyxrc.display_graphics
using std::endl;
-static double const tol = 1.0e-08;
+namespace {
+
+// Zero test for double precision numbers
+double const tol = 1.0e-08;
+
+// The maximum digits for the image scale
+int const SCALE_MAXDIGITS = 3;
+
+// The maximum digits for the image width
+int const WIDTH_MAXDIGITS = 3;
+
+// The maximum digits for the image height
+int const HEIGHT_MAXDIGITS = 3;
+
+// The max characters in the rotation angle (minus sign and 3 digits)
+int const ROTATE_MAXCHARS = 4;
+
+// The maximum characters in a filename.
+int const FILENAME_MAXCHARS = 1024;
+
+} // namespace anon
+
typedef FormCB<ControlGraphics, FormDB<FD_form_graphics> > base_class;
igp.filename = fl_get_input(dialog_->input_filename);
- if (fl_get_button(dialog_->check_display)) {
- igp.display = InsetGraphicsParams::COLOR;
- } else {
+ if (lyxrc.display_graphics == "no") {
igp.display = InsetGraphicsParams::NONE;
+
+ } else {
+ if (fl_get_button(dialog_->check_display)) {
+ if (lyxrc.display_graphics == "mono") {
+ igp.display = InsetGraphicsParams::MONOCHROME;
+ } else if (lyxrc.display_graphics == "gray") {
+ igp.display = InsetGraphicsParams::GRAYSCALE;
+ } else if (lyxrc.display_graphics == "color") {
+ igp.display = InsetGraphicsParams::COLOR;
+ }
+
+ } else {
+ igp.display = InsetGraphicsParams::NONE;
+ }
}
double const scale =
igp.filename.c_str());
// To display or not to display
- if (igp.display == InsetGraphicsParams::NONE) {
+ if (lyxrc.display_graphics == "no") {
fl_set_button(dialog_->check_display, 0);
} else {
- fl_set_button(dialog_->check_display, 1);
+ if (igp.display == InsetGraphicsParams::NONE) {
+ fl_set_button(dialog_->check_display, 0);
+ } else {
+ fl_set_button(dialog_->check_display, 1);
+ }
}
+ setEnabled(dialog_->check_display, (lyxrc.display_graphics != "no"));
+
if (igp.heightResize == InsetGraphicsParams::SCALE) {
string number = tostr(igp.heightSize);
fl_set_input(dialog_->input_scale, number.c_str());
fl_set_input(dialog_->input_width, number.c_str());
int pos = 1;
+ //use inch as default with US papersizes in lyxrc
+ if (lyxrc.default_papersize < 3)
+ pos = 2;
switch (igp.widthResize) {
+ case InsetGraphicsParams::CM:
+ pos = 1; break;
+
case InsetGraphicsParams::INCH:
pos = 2; break;
fl_set_input(dialog_->input_height, number.c_str());
pos = 1;
+ //use inch as default with US papersizes in lyxrc
+ if (lyxrc.default_papersize < 3)
+ pos = 2;
switch (igp.heightResize) {
+ case InsetGraphicsParams::CM:
+ pos = 1; break;
+
case InsetGraphicsParams::INCH:
pos = 2; break;
default:
break;
}
- fl_set_choice(dialog_->choice_width_units, pos);
+ fl_set_choice(dialog_->choice_height_units, pos);
}
// Update the rotate angle