+2002-08-24 John Levon <levon@movementarian.org>
+
+ * buffer.C:
+ * bufferlist.C:
+ * bufferview_funcs.C:
+ * lyxfont.C:
+ * undo_funcs.C: cleanups
+
+ * lyxfunc.C: disable CUT/COPY when no selection
+
+2002-08-23 Rob Lahaye <lahaye@snu.ac.kr>
+
+ * lyxlength.[Ch]: use better (three letters) mnemonics for percentage units
+ in "enum UNIT"; e.g. PTW for Percent of TextWidth
+
+ * lyxrc.C: graphics display is now monochrome|grayscale|color|none.
+ Add backward compatibility to "mono", "gray" and "no".
+
2002-08-24 Dekel Tsur <dekelts@tau.ac.il>
* buffer.C (readFile): Always run lyx2lyx if file_format < LYX_FORMAT
filename_(file), users(0), ctrs(new Counters)
{
lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
-// filename = file;
filepath_ = OnlyPath(file);
-// lyx_clean = true;
-// bak_clean = true;
-// dep_clean = 0;
-// read_only = ronly;
-// unnamed = false;
-// users = 0;
lyxvc.buffer(this);
if (read_only || lyxrc.use_tempdir) {
tmppath = CreateBufferTmpDir();
}
}
+ if (!keys.empty())
+ return keys;
+
// Might be either using bibtex or a child has bibliography
- if (keys.empty()) {
- for (inset_iterator it = inset_const_iterator_begin();
- it != inset_const_iterator_end(); ++it) {
- // Search for Bibtex or Include inset
- if (it->lyxCode() == Inset::BIBTEX_CODE) {
- vector<StringPair> tmp =
- static_cast<InsetBibtex &>(*it).getKeys(this);
- keys.insert(keys.end(), tmp.begin(), tmp.end());
- } else if (it->lyxCode() == Inset::INCLUDE_CODE) {
- vector<StringPair> const tmp =
- static_cast<InsetInclude &>(*it).getKeys();
- keys.insert(keys.end(), tmp.begin(), tmp.end());
- }
+ for (inset_iterator it = inset_const_iterator_begin();
+ it != inset_const_iterator_end(); ++it) {
+ // Search for Bibtex or Include inset
+ if (it->lyxCode() == Inset::BIBTEX_CODE) {
+ vector<StringPair> tmp =
+ static_cast<InsetBibtex &>(*it).getKeys(this);
+ keys.insert(keys.end(), tmp.begin(), tmp.end());
+ } else if (it->lyxCode() == Inset::INCLUDE_CODE) {
+ vector<StringPair> const tmp =
+ static_cast<InsetInclude &>(*it).getKeys();
+ keys.insert(keys.end(), tmp.begin(), tmp.end());
}
}
if (buf->isClean())
return;
- lyxerr << _("lyx: Attempting to save document ")
- << (buf->isUnnamed() ? OnlyFilename(buf->fileName())
- : buf->fileName())
- << _(" as...") << endl;
+ string const doc = buf->isUnnamed()
+ ? OnlyFilename(buf->fileName()) : buf->fileName();
+
+ lyxerr << _("LyX: Attempting to save document ") << doc << endl;
// We try to save three places:
{
ostringstream state;
- if (bv->available()) {
- // I think we should only show changes from the default
- // font. (Asger)
- LyXText * text = bv->getLyXText();
- Buffer * buffer = bv->buffer();
- LyXFont font = text->real_current_font;
- LyXFont const & defaultfont =
- buffer->params.getLyXTextClass().defaultfont();
- font.reduce(defaultfont);
-
- state << _("Font:") << ' '
- << font.stateText(&buffer->params);
-
- // The paragraph depth
- int depth = text->getDepth();
- if (depth > 0)
- state << _(", Depth: ") << depth;
-
- // The paragraph spacing, but only if different from
- // buffer spacing.
- if (!text->cursor.par()->params().spacing().isDefault()) {
- Spacing::Space cur_space =
- text->cursor.par()->params().spacing().getSpace();
- state << _(", Spacing: ");
-
- switch (cur_space) {
- case Spacing::Single:
- state << _("Single");
-
- break;
- case Spacing::Onehalf:
- state << _("Onehalf");
- break;
- case Spacing::Double:
- state << _("Double");
- break;
- case Spacing::Other:
- state << _("Other (")
- << text->cursor.par()->params().spacing().getValue()
- << ")";
- break;
- case Spacing::Default:
- // should never happen, do nothing
- break;
- }
+ if (!bv->available())
+ return "";
+
+ // I think we should only show changes from the default
+ // font. (Asger)
+ LyXText * text = bv->getLyXText();
+ Buffer * buffer = bv->buffer();
+ LyXFont font = text->real_current_font;
+ LyXFont const & defaultfont =
+ buffer->params.getLyXTextClass().defaultfont();
+ font.reduce(defaultfont);
+
+ state << _("Font:") << ' ' << font.stateText(&buffer->params);
+
+ // The paragraph depth
+ int depth = text->getDepth();
+ if (depth > 0)
+ state << _(", Depth: ") << depth;
+
+ // The paragraph spacing, but only if different from
+ // buffer spacing.
+ if (!text->cursor.par()->params().spacing().isDefault()) {
+ Spacing::Space cur_space =
+ text->cursor.par()->params().spacing().getSpace();
+ state << _(", Spacing: ");
+
+ switch (cur_space) {
+ case Spacing::Single:
+ state << _("Single");
+ break;
+ case Spacing::Onehalf:
+ state << _("Onehalf");
+ break;
+ case Spacing::Double:
+ state << _("Double");
+ break;
+ case Spacing::Other:
+ state << _("Other (")
+ << text->cursor.par()->params().spacing().getValue()
+ << ")";
+ break;
+ case Spacing::Default:
+ // should never happen, do nothing
+ break;
}
+ }
#ifdef DEVEL_VERSION
- state << _(", Paragraph: ") << text->cursor.par()->id();
+ state << _(", Paragraph: ") << text->cursor.par()->id();
#endif
- }
return state.str().c_str();
}
+2002-08-23 Rob Lahaye <lahaye@snu.ac.kr>
+
+ * ControlGraphics.C: make rotationOrigin's default ("leftBaseline") the
+ first item in the list
+
2002-08-15 Angus Leeming <leeming@lyx.org>
* ControlConnections.C: Dialogs::redrawGUI is now a method not a signal.
// end of each line.
char const * const rorigin_lyx_strs[] = {
// the LaTeX default is leftBaseline
- "center", // c
- "leftTop", "leftBottom", "leftBaseline", // lt lb lB
- "centerTop", "centerBottom", "centerBaseline", // ct cb cB
- "rightTop", "rightBottom", "rightBaseline" }; // rt rb rB
+ "leftBaseline", "leftTop", "leftBottom", // lB lt lb
+ "center", "centerBaseline", "centerTop", "centerBottom", // c cB ct cb
+ "rightBaseline", "rightTop", "rightBottom" }; // rt rb rB
// These are the strings, corresponding to the above, that the GUI should
// use. Note that they can/should be translated.
char const * const rorigin_gui_strs[] = {
- N_("center"),
- N_("left top"), N_("left bottom"), N_("left baseline"),
- N_("center top"), N_("center bottom"), N_("center baseline"),
- N_("right top"), N_("right bottom"), N_("right baseline") };
+ N_("left baseline"), N_("left top"), N_("left bottom"),
+ N_("center"), N_("center baseline"), N_("center top"), N_("center bottom"),
+ N_("right baseline"), N_("right top"), N_("right bottom") };
size_t const rorigin_size = sizeof(rorigin_lyx_strs) / sizeof(char *);
+2002-08-23 Rob Lahaye <lahaye@snu.ac.kr>
+
+ * lengthcombo.C: apply changes to "enum UNIT" in src/lyxlength.h
+
+ * QLImage.C:
+ * QGraphics.C: Implement changes for new xforms graphics dialog
+ (NB: Qt Graphics dialog itself is NOT YET updated!).
+
2002-08-15 Angus Leeming <leeming@lyx.org>
* lyx_gui.C (hexname): enable previews to work!
{
InsetGraphicsParams & igp = controller().params();
+ // set the right default unit
string unit = "cm";
- if (lyxrc.default_papersize < 3)
- unit = "in";
+ switch (lyxrc.default_papersize) {
+ case BufferParams::PAPER_DEFAULT: break;
+
+ case BufferParams::PAPER_USLETTER:
+ case BufferParams::PAPER_LEGALPAPER:
+ case BufferParams::PAPER_EXECUTIVEPAPER: unit = "in"; break;
+
+ case BufferParams::PAPER_A3PAPER:
+ case BufferParams::PAPER_A4PAPER:
+ case BufferParams::PAPER_A5PAPER:
+ case BufferParams::PAPER_B5PAPER: unit = "cm"; break;
+ }
+ // ?? defaultUnit is not used !!
string const defaultUnit = string(unit);
// Update dialog with details from inset
int item;
switch (igp.display) {
- case InsetGraphicsParams::DEFAULT: item = 0; break;
- case InsetGraphicsParams::MONOCHROME: item = 1; break;
- case InsetGraphicsParams::GRAYSCALE: item = 2; break;
- case InsetGraphicsParams::COLOR: item = 3; break;
- case InsetGraphicsParams::NONE: item = 4; break;
+ case grfx::DefaultDisplay: item = 0; break;
+ case grfx::MonochromeDisplay: item = 1; break;
+ case grfx::GrayscaleDisplay: item = 2; break;
+ case grfx::ColorDisplay: item = 3; break;
+ case grfx::NoDisplay: item = 4; break;
}
dialog_->show->setCurrentItem(item);
- QRadioButton * b;
-
- switch (igp.lyxsize_kind) {
- case InsetGraphicsParams::DEFAULT_SIZE: b = dialog_->displaydefaultRB; break;
- case InsetGraphicsParams::WH: b = dialog_->displaycustomRB; break;
- case InsetGraphicsParams::SCALE: b = dialog_->displayscaleRB; break;
- }
- b->setChecked(true);
-
- dialog_->displaywidthUnit->setCurrentItem(igp.lyxwidth.unit());
- dialog_->displayheightUnit->setCurrentItem(igp.lyxheight.unit());
- dialog_->displaywidth->setText(tostr(igp.lyxwidth.value()).c_str());
- dialog_->displayheight->setText(tostr(igp.lyxheight.value()).c_str());
dialog_->displayscale->setText(tostr(igp.lyxscale).c_str());
- dialog_->displayratioCB->setChecked(igp.keepLyXAspectRatio);
- switch (igp.size_kind) {
- case InsetGraphicsParams::DEFAULT_SIZE: b = dialog_->defaultRB; break;
- case InsetGraphicsParams::WH: b = dialog_->customRB; break;
- case InsetGraphicsParams::SCALE: b = dialog_->scaleRB; break;
- }
- b->setChecked(true);
-
dialog_->widthUnit->setCurrentItem(igp.width.unit());
dialog_->heightUnit->setCurrentItem(igp.height.unit());
- dialog_->width->setText(tostr(igp.width.value()).c_str());
- dialog_->height->setText(tostr(igp.height.value()).c_str());
- dialog_->scale->setText(tostr(igp.scale).c_str());
dialog_->aspectratio->setChecked(igp.keepAspectRatio);
// Update the rotate angle
igp.subcaptionText = dialog_->subcaption->text();
switch (dialog_->show->currentItem()) {
- case 0: igp.display = InsetGraphicsParams::DEFAULT; break;
- case 1: igp.display = InsetGraphicsParams::MONOCHROME; break;
- case 2: igp.display = InsetGraphicsParams::GRAYSCALE; break;
- case 3: igp.display = InsetGraphicsParams::COLOR; break;
- case 4: igp.display = InsetGraphicsParams::NONE; break;
+ case 0: igp.display = grfx::DefaultDisplay; break;
+ case 1: igp.display = grfx::MonochromeDisplay; break;
+ case 2: igp.display = grfx::GrayscaleDisplay; break;
+ case 3: igp.display = grfx::ColorDisplay; break;
+ case 4: igp.display = grfx::NoDisplay; break;
default:;
}
- if (dialog_->defaultRB->isChecked())
- igp.size_kind = InsetGraphicsParams::DEFAULT_SIZE;
- else if (dialog_->customRB->isChecked())
- igp.size_kind = InsetGraphicsParams::WH;
- else
- igp.size_kind = InsetGraphicsParams::SCALE;
-
string value(dialog_->width->text());
igp.width = LyXLength(strToDbl(value), dialog_->widthUnit->currentLengthItem());
value = string(dialog_->height->text());
igp.height = LyXLength(strToDbl(value), dialog_->heightUnit->currentLengthItem());
- igp.scale = strToInt(string(dialog_->scale->text()));
igp.keepAspectRatio = dialog_->aspectratio->isChecked();
- if (dialog_->displaydefaultRB->isChecked())
- igp.lyxsize_kind = InsetGraphicsParams::DEFAULT_SIZE;
- else if (dialog_->displaycustomRB->isChecked())
- igp.lyxsize_kind = InsetGraphicsParams::WH;
- else
- igp.lyxsize_kind = InsetGraphicsParams::SCALE;
-
- value = string(dialog_->displaywidth->text());
- igp.lyxwidth = LyXLength(strToDbl(value), dialog_->displaywidthUnit->currentLengthItem());
- value = string(dialog_->displayheight->text());
- igp.lyxheight = LyXLength(strToDbl(value), dialog_->displayheightUnit->currentLengthItem());
-
igp.lyxscale = strToInt(string(dialog_->displayscale->text()));
- igp.keepLyXAspectRatio = dialog_->displayratioCB->isChecked();
igp.rotateAngle = strToDbl(string(dialog_->angle->text()));
-
- while (igp.rotateAngle < 0.0 || igp.rotateAngle > 360.0) {
- if (igp.rotateAngle < 0.0) {
- igp.rotateAngle += 360.0;
- } else if (igp.rotateAngle > 360.0) {
- igp.rotateAngle -= 360.0;
- }
- }
+ while (igp.rotateAngle < -360.0) igp.rotateAngle += 360.0;
+ while (igp.rotateAngle > 360.0) igp.rotateAngle -= 360.0;
if ((dialog_->origin->currentItem()) > 0)
igp.rotateOrigin = dialog_->origin->currentText();
else
igp.rotateOrigin = string();
- igp.rotate = igp.rotateAngle != 0.0;
-
igp.special = dialog_->latexoptions->text();
}
if (new_width == pixmap_.width() && new_height == pixmap_.height())
return;
- int const xoffset_l = std::max(0, params.bb.xl);
- int const yoffset_t = std::max(0, pixmap_.height() - params.bb.yt);
+ int const xoffset_l = std::max(0, int(params.bb.xl));
+ int const yoffset_t = std::max(0, pixmap_.height() - int(params.bb.yt));
xformed_pixmap_.resize(new_width, new_height);
QPainter p;
case 9: unit = LyXLength::DD; break;
case 10: unit = LyXLength::CC; break;
case 11: unit = LyXLength::MU; break;
- case 12: unit = LyXLength::PP; break;
- case 13: unit = LyXLength::PW; break;
- case 14: unit = LyXLength::PL; break;
- // FIXME: LyXLength::PE ?
+ case 12: unit = LyXLength::PPW; break;
+ case 13: unit = LyXLength::PCW; break;
+ case 14: unit = LyXLength::PLW; break;
+ // FIXME: LyXLength::PTW ?
};
return unit;
}
case LyXLength::DD: i = 9; break;
case LyXLength::CC: i = 10; break;
case LyXLength::MU: i = 11; break;
- case LyXLength::PP: i = 12; break;
- case LyXLength::PW: i = 13; break;
- case LyXLength::PL: i = 14; break;
- // FIXME: LyXLength::PE ?
+ case LyXLength::PPW: i = 12; break;
+ case LyXLength::PCW: i = 13; break;
+ case LyXLength::PLW: i = 14; break;
+ // FIXME: LyXLength::PTW ?
}
QComboBox::setCurrentItem(i);
}
+2002-08-24 John Levon <levon@movementarian.org>
+
+ * xformsImage.C: fix build, add FIXME for Rob
+
+2002-08-23 Rob Lahaye <lahaye@snu.ac.kr>
+
+ * FormGraphics.[Ch]:
+ * forms/form_graphics.fd: Implement new graphics dialog
+
+ * FormPreferences.C: use display_graphics "monochrome|grayscale|none"
+ instead of "mono|gray|no".
+
2002-08-22 John Levon <levon@movementarian.org>
- * fontloader.C: show name of failed font load (from Mikhail Teterin)
+ * xfont_loader.C: show name of failed font load (from Mikhail Teterin)
2002-08-20 Lars Gullik Bjønnes <larsbj@birdstep.com>
namespace {
// Bound the number of input characters
-int const SCALE_MAXDIGITS = 3; // %-value
-int const WIDTH_MAXDIGITS = 10;
-int const HEIGHT_MAXDIGITS = 10;
-int const ROTATE_MAXCHARS = 5; // like 270.1
int const FILENAME_MAXCHARS = 1024;
+
string defaultUnit("cm");
/// Given input and choice widgets, create a LyXLength
file_.reset(build_graphics_file(this));
fl_set_input_return (file_->input_filename, FL_RETURN_CHANGED);
- fl_set_input_return (file_->input_subcaption, FL_RETURN_CHANGED);
- fl_set_input_return (file_->input_rotate_angle, FL_RETURN_CHANGED);
- fl_set_input_maxchars(file_->input_filename, FILENAME_MAXCHARS);
- fl_set_input_maxchars(file_->input_rotate_angle, ROTATE_MAXCHARS);
- fl_set_input_filter(file_->input_rotate_angle, fl_float_filter);
+ fl_set_input_return (file_->input_lyxscale, FL_RETURN_CHANGED);
+ fl_set_input_return (file_->input_width, FL_RETURN_CHANGED);
+ fl_set_input_return (file_->input_height, FL_RETURN_CHANGED);
setPrehandler(file_->input_filename);
- setPrehandler(file_->input_subcaption);
- setPrehandler(file_->input_rotate_angle);
+ setPrehandler(file_->input_lyxscale);
+ setPrehandler(file_->input_width);
+ setPrehandler(file_->input_height);
- using namespace frnt;
- vector<RotationOriginPair> origindata = getRotationOriginData();
+ fl_set_input_maxchars(file_->input_filename, FILENAME_MAXCHARS);
+ fl_set_input_filter(file_->input_lyxscale, fl_unsigned_int_filter);
- // Store the identifiers for later
- origins_ = getSecond(origindata);
+ // width default is scaling, thus unsigned integer input
+ fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
+ fl_set_input_filter(file_->input_height, fl_unsigned_float_filter);
- string const choice =
- " " + getStringFromVector(getFirst(origindata), " | ") +" ";
- fl_addto_choice(file_->choice_origin, choice.c_str());
+ fl_addto_choice(file_->choice_display, _("Default|Monochrome|Grayscale|Color|Do not display"));
+ fl_addto_choice(file_->choice_width, (_("Scale%%|") + choice_Length_All).c_str());
+ fl_addto_choice(file_->choice_height, choice_Length_All.c_str());
- bc().addReadOnly(file_->button_browse);
- bc().addReadOnly(file_->check_subcaption);
- bc().addReadOnly(file_->check_rotate);
+ bc().addReadOnly(file_->button_browse);
+ bc().addReadOnly(file_->check_aspectratio);
bc().addReadOnly(file_->check_draft);
bc().addReadOnly(file_->check_nounzip);
str = _("Browse the directories.");
tooltips().init(file_->button_browse, str);
- str = _("Enables use of subfigure with an own caption.");
- tooltips().init(file_->check_subcaption, str);
- str = _("Insert the an optional subfigure caption");
- tooltips().init(file_->input_subcaption, str);
-
- str = _("Enables use of rotating for the image.");
- tooltips().init(file_->check_rotate, str);
- str = _("Insert the rotating angle in degrees (max 5 characters like 270.1)");
- tooltips().init(file_->input_rotate_angle, str);
-
- str = _("Insert the rotating origin point.");
- tooltips().init(file_->choice_origin, str);
+ str = _("Scale the image to inserted percentage value");
+ tooltips().init(file_->input_lyxscale, str);
+ str = _("Select display mode for this image.");
+ tooltips().init(file_->choice_display, str);
+
+ str = _("Set the image width to the inserted value.");
+ tooltips().init(file_->input_width, str);
+ str = _("Select unit for width; Scale% for scaling whole image");
+ tooltips().init(file_->choice_width, str);
+ str = _("Set the image height to the inserted value.");
+ tooltips().init(file_->input_height, str);
+ str = _("Select unit for height");
+ tooltips().init(file_->choice_height, str);
+ str = _("Do not distort the image. "
+ "Keep image within \"width\" by \"height\" and obey aspect ratio.");
+ tooltips().init(file_->check_aspectratio, str);
str = _("Pass a filename like \"file.eps.gz\" to the LaTeX output. "
"This is useful when LaTeX should unzip the file. Needs an additional file "
- "like \"file.eps.bb\" which holds the values for the bounding box");
+ "like \"file.eps.bb\" which holds the values for the bounding box.");
tooltips().init(file_->check_nounzip, str);
str = _("Show image only as a rectangle of the original size.");
tooltips().init(file_->check_draft, str);
- // the lyxview section
- lyxview_.reset(build_graphics_lyxview(this));
-
- fl_set_input_return (lyxview_->input_lyxwidth, FL_RETURN_CHANGED);
- fl_set_input_return (lyxview_->input_lyxheight, FL_RETURN_CHANGED);
- fl_set_input_return (lyxview_->input_lyxscale, FL_RETURN_CHANGED);
-
- setPrehandler(lyxview_->input_lyxwidth);
- setPrehandler(lyxview_->input_lyxheight);
- setPrehandler(lyxview_->input_lyxscale);
-
- fl_addto_choice(lyxview_->choice_lyxwidth, choice_Length_WithUnit.c_str());
- fl_addto_choice(lyxview_->choice_lyxheight, choice_Length_WithUnit.c_str());
-
- bc().addReadOnly(lyxview_->radio_pref);
- bc().addReadOnly(lyxview_->radio_mono);
- bc().addReadOnly(lyxview_->radio_gray);
- bc().addReadOnly(lyxview_->radio_color);
- bc().addReadOnly(lyxview_->radio_nodisplay);
- bc().addReadOnly(lyxview_->check_lyxaspectratio);
-
- // set up the tooltips for the lyxview section
- str = _("Take the definition from the Preferences->Look&Feel->Misc as default.");
- tooltips().init(lyxview_->radio_pref, str);
- str = _("Show this image in black and white (monochrome).");
- tooltips().init(lyxview_->radio_mono, str);
- str = _("Show this image in grayscale.");
- tooltips().init(lyxview_->radio_gray, str);
- str = _("Show this image in color.");
- tooltips().init(lyxview_->radio_color, str);
- str = _("Do not display this image.");
- tooltips().init(lyxview_->radio_nodisplay, str);
-
- str = _("Copies all values from the LaTeX tab");
- tooltips().init(lyxview_->button_latex_values, str);
-
- str = _("Show this image in it's original size.");
- tooltips().init(lyxview_->radio_lyxasis, str);
- str = _("Scale the image down to the inserted values.");
- tooltips().init(lyxview_->radio_lyxwh, str);
- str = _("Scale the image down to the inserted value and keep aspectratio.");
- tooltips().init(lyxview_->radio_lyxscale, str);
-
- str = _("Insert a width in any valid unit to which the image in the LyX-view "
- "should be scaled up/down");
- tooltips().init(lyxview_->input_lyxwidth, str);
- str = _("Insert a height in any valid unit to which the image in the LyX-view "
- "should be scaled up/down");
- tooltips().init(lyxview_->input_lyxheight, str);
- str = _("Insert a value > 0 in persent to which the image should be scaled up/down");
- tooltips().init(lyxview_->input_lyxscale, str);
- str = _("Shows all possible units for the length");
- tooltips().init(lyxview_->choice_lyxwidth, str);
- tooltips().init(lyxview_->choice_lyxheight, str);
- str = _("Modifies the meaning of the \"width\" and \"height\" (and "
- "\"totalheight\") keys such that if both are specified then rather than "
- "distort the figure the figure is scaled such that neither dimension "
- "exceeds the stated dimensions.");
- tooltips().init(lyxview_->check_lyxaspectratio, str);
-
- // the size section
- size_.reset(build_graphics_size(this));
-
- fl_set_input_return (size_->input_scale, FL_RETURN_CHANGED);
- fl_set_input_return (size_->input_width, FL_RETURN_CHANGED);
- fl_set_input_return (size_->input_height, FL_RETURN_CHANGED);
-
- setPrehandler(size_->input_scale);
- setPrehandler(size_->input_width);
- setPrehandler(size_->input_height);
-
- fl_set_input_maxchars(size_->input_scale, SCALE_MAXDIGITS);
- fl_set_input_maxchars(size_->input_width, WIDTH_MAXDIGITS);
- fl_set_input_maxchars(size_->input_height, HEIGHT_MAXDIGITS);
-
- fl_set_input_filter(size_->input_scale, fl_unsigned_float_filter);
-
- fl_addto_choice(size_->choice_width, choice_Length_All.c_str());
- fl_addto_choice(size_->choice_height, choice_Length_All.c_str());
-
- bc().addReadOnly(size_->radio_asis);
- bc().addReadOnly(size_->radio_wh);
- bc().addReadOnly(size_->radio_scale);
- bc().addReadOnly(size_->check_aspectratio);
-
- // set up the tooltips for the size section
- str = _("Copies all values from the LyX tab");
- tooltips().init(size_->button_lyx_values, str);
-
- str = _("Show this image in it's original size.");
- tooltips().init(size_->radio_asis, str);
- str = _("Scale the image down to the inserted values.");
- tooltips().init(size_->radio_wh, str);
- str = _("Scale the image down to the inserted value and keep aspectratio.");
- tooltips().init(size_->radio_scale, str);
-
- str = _("Modifies the meaning of the \"width\" and \"height\" (and "
- "\"totalheight\") keys such that if both are specified then rather than "
- "distort the figure the figure is scaled such that neither dimension "
- "exceeds the stated dimensions.");
- tooltips().init(size_->check_aspectratio, str);
-
- str = _("Insert a width in any valid unit to which the image in the LyX-view "
- "should be scaled up/down");
- tooltips().init(lyxview_->input_lyxwidth, str);
- str = _("Insert a height in any valid unit to which the image in the LyX-view "
- "should be scaled up/down");
- tooltips().init(lyxview_->input_lyxheight, str);
- str = _("Insert a value > 0 in persent to which the image should be scaled up/down");
- tooltips().init(lyxview_->input_lyxscale, str);
- str = _("Shows all possible units for the length");
- tooltips().init(lyxview_->choice_lyxwidth, str);
- tooltips().init(lyxview_->choice_lyxheight, str);
-
// the bounding box selection
bbox_.reset(build_graphics_bbox(this));
fl_set_input_return (bbox_->input_bb_x0, FL_RETURN_CHANGED);
fl_set_input_return (bbox_->input_bb_x1, FL_RETURN_CHANGED);
fl_set_input_return (bbox_->input_bb_y1, FL_RETURN_CHANGED);
- fl_set_input_filter(bbox_->input_bb_x0, fl_unsigned_float_filter);
- fl_set_input_filter(bbox_->input_bb_y0, fl_unsigned_float_filter);
- fl_set_input_filter(bbox_->input_bb_x1, fl_unsigned_float_filter);
- fl_set_input_filter(bbox_->input_bb_y1, fl_unsigned_float_filter);
+ fl_set_input_filter(bbox_->input_bb_x0, fl_unsigned_float_filter);
+ fl_set_input_filter(bbox_->input_bb_y0, fl_unsigned_float_filter);
+ fl_set_input_filter(bbox_->input_bb_x1, fl_unsigned_float_filter);
+ fl_set_input_filter(bbox_->input_bb_y1, fl_unsigned_float_filter);
setPrehandler(bbox_->input_bb_x0);
setPrehandler(bbox_->input_bb_y0);
tooltips().init(bbox_->input_bb_x1, str);
str = _("The upper right y-value of the bounding box");
tooltips().init(bbox_->input_bb_y1, str);
- str = _("Shows all possible units for the bounding box values");
+ str = _("Select unit for the bounding box values");
tooltips().init(bbox_->choice_bb_units, str);
str = _("Read the image coordinates new from file. If it's an (e)ps-file "
- "than the bounding box is read otherwise the imagesize in pixels. "
- "The default unit is \"bp\" the PostScript b)ig p)oint.");
+ "then the bounding box is read otherwise the imagesize in pixels. "
+ "The default unit is \"bp\", the PostScript's b(ig) p(oint).");
tooltips().init(bbox_->button_getBB, str);
str = _("Enable this checkbox when the image should be clipped to the "
"bounding box values.");
tooltips().init(bbox_->check_clip, str);
- // the rotate section
- special_.reset(build_graphics_special(this));
+ // the extra section
+ extra_.reset(build_graphics_extra(this));
+
+ fl_set_input_return (extra_->input_rotate_angle, FL_RETURN_CHANGED);
+ fl_set_input_return (extra_->input_subcaption, FL_RETURN_CHANGED);
+ fl_set_input_return (extra_->input_special, FL_RETURN_CHANGED);
- fl_set_input_return (special_->input_special, FL_RETURN_CHANGED);
- setPrehandler(special_->input_special);
+ fl_set_input_filter(extra_->input_rotate_angle, fl_float_filter);
- // set up the tooltips for the special section
- str = _("Any additional option, which is defined in the graphicx-package "
- "and not mentioned in the gui's tabfolders can be defined.");
- tooltips().init(special_->input_special, str);
+ setPrehandler(extra_->input_rotate_angle);
+ setPrehandler(extra_->input_subcaption);
+ setPrehandler(extra_->input_special);
+
+ bc().addReadOnly(extra_->check_subcaption);
+
+ using namespace frnt;
+ vector<RotationOriginPair> origindata = getRotationOriginData();
+
+ // Store the identifiers for later
+ origins_ = getSecond(origindata);
+
+ string const choice = " " + getStringFromVector(getFirst(origindata), " | ") + " ";
+ fl_addto_choice(extra_->choice_origin, choice.c_str());
+
+ // set up the tooltips for the extra section
+ str = _("Insert the rotation angle in degrees. "
+ "Positive value rotates anti-clockwise, negative value clockwise");
+ tooltips().init(extra_->input_rotate_angle, str);
+ str = _("Insert the point of origin for rotation ");
+ tooltips().init(extra_->choice_origin, str);
+ str = _("Enables use of subfigure with its own caption.");
+ tooltips().init(extra_->check_subcaption, str);
+ str = _("Insert the optional subfigure caption");
+ tooltips().init(extra_->input_subcaption, str);
+ str = _("Add any additional latex option, which is defined in the "
+ "graphicx-package and not mentioned in the gui's tabfolders.");
+ tooltips().init(extra_->input_special, str);
// add the different tabfolders
fl_addto_tabfolder(dialog_->tabfolder, _("File"), file_->form);
- fl_addto_tabfolder(dialog_->tabfolder, _("LyX View"), lyxview_->form);
- fl_addto_tabfolder(dialog_->tabfolder, _("LaTeX Size"), size_->form);
fl_addto_tabfolder(dialog_->tabfolder, _("Bounding Box"), bbox_->form);
- fl_addto_tabfolder(dialog_->tabfolder, _("Extras"), special_->form);
+ fl_addto_tabfolder(dialog_->tabfolder, _("Extra"), extra_->form);
// set the right default unit
- if (lyxrc.default_papersize < 3)
- defaultUnit = "in";
+ switch (lyxrc.default_papersize) {
+ case BufferParams::PAPER_DEFAULT: break;
+ case BufferParams::PAPER_USLETTER:
+ case BufferParams::PAPER_LEGALPAPER:
+ case BufferParams::PAPER_EXECUTIVEPAPER: defaultUnit = "in"; break;
+ case BufferParams::PAPER_A3PAPER:
+ case BufferParams::PAPER_A4PAPER:
+ case BufferParams::PAPER_A5PAPER:
+ case BufferParams::PAPER_B5PAPER: defaultUnit = "cm"; break;
+ }
}
// the file section
igp.filename = getString(file_->input_filename);
- igp.subcaption = fl_get_button(file_->check_subcaption);
- igp.subcaptionText = getString(file_->input_subcaption);
- igp.rotate = fl_get_button(file_->check_rotate);
- igp.rotateAngle =
- strToDbl(getString(file_->input_rotate_angle));
- while (igp.rotateAngle < 0.0 || igp.rotateAngle > 360.0) {
- if (igp.rotateAngle < 0.0) {
- igp.rotateAngle += 360.0;
- } else if (igp.rotateAngle > 360.0) {
- igp.rotateAngle -= 360.0;
- }
+
+ igp.lyxscale = strToInt(getString(file_->input_lyxscale));
+ if (igp.lyxscale == 0) igp.lyxscale = 100;
+
+ switch (fl_get_choice(file_->choice_display)) {
+ case 5: igp.display = grfx::NoDisplay; break;
+ case 4: igp.display = grfx::ColorDisplay; break;
+ case 3: igp.display = grfx::GrayscaleDisplay; break;
+ case 2: igp.display = grfx::MonochromeDisplay; break;
+ case 1:
+ default: igp.display = grfx::DefaultDisplay;
}
- int const pos = fl_get_choice(file_->choice_origin);
- if (pos > 0)
- igp.rotateOrigin = origins_[pos-1];
- else
- igp.rotateOrigin = string();
+
+ // first item in choice_width means scaling
+ if (fl_get_choice(file_->choice_width) == 1) {
+ igp.scale = strToInt(getString(file_->input_width));
+ if (igp.scale == 0) igp.scale = 100;
+ igp.width = LyXLength();
+ }
+ else {
+ igp.scale = 0;
+ igp.width = getLyXLengthFromWidgets(file_->input_width,
+ file_->choice_width);
+ }
+ igp.height = getLyXLengthFromWidgets(file_->input_height,
+ file_->choice_height);
+ igp.keepAspectRatio = fl_get_button(file_->check_aspectratio);
igp.draft = fl_get_button(file_->check_draft);
igp.noUnzip = fl_get_button(file_->check_nounzip);
- // the lyxview section
- if (fl_get_button(lyxview_->radio_pref))
- igp.display = InsetGraphicsParams::DEFAULT;
- else if (fl_get_button(lyxview_->radio_mono))
- igp.display = InsetGraphicsParams::MONOCHROME;
- else if (fl_get_button(lyxview_->radio_gray))
- igp.display = InsetGraphicsParams::GRAYSCALE;
- else if (fl_get_button(lyxview_->radio_color))
- igp.display = InsetGraphicsParams::COLOR;
- else if (fl_get_button(lyxview_->radio_nodisplay))
- igp.display = InsetGraphicsParams::NONE;
-
- if (fl_get_button(lyxview_->radio_lyxasis))
- igp.lyxsize_kind = InsetGraphicsParams::DEFAULT_SIZE;
- else if (fl_get_button(lyxview_->radio_lyxwh))
- igp.lyxsize_kind = InsetGraphicsParams::WH;
- else
- igp.lyxsize_kind = InsetGraphicsParams::SCALE;
-
- igp.lyxwidth = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
- lyxview_->choice_lyxwidth);
-
- igp.lyxheight = getLyXLengthFromWidgets(lyxview_->input_lyxheight,
- lyxview_->choice_lyxheight);
-
- igp.lyxscale = strToInt(getString(lyxview_->input_lyxscale));
- igp.keepLyXAspectRatio = fl_get_button(lyxview_->check_lyxaspectratio);
-
- // the size section
- if (fl_get_button(size_->radio_asis))
- igp.size_kind = InsetGraphicsParams::DEFAULT_SIZE;
- else if (fl_get_button(size_->radio_wh))
- igp.size_kind = InsetGraphicsParams::WH;
- else
- igp.size_kind = InsetGraphicsParams::SCALE;
-
- igp.width = getLyXLengthFromWidgets(size_->input_width,
- size_->choice_width);
-
- igp.height = getLyXLengthFromWidgets(size_->input_height,
- size_->choice_height);
-
- igp.scale = strToInt(getString(size_->input_scale));
- igp.keepAspectRatio = fl_get_button(size_->check_aspectratio);
-
// the bb section
- if (!controller().bbChanged) // different to the original one?
- igp.bb = string(); // don't write anything
+ if (!controller().bbChanged) // different to the original one?
+ igp.bb = string(); // don't write anything
else {
string bb;
if (getString(bbox_->input_bb_x0).empty())
}
igp.clip = fl_get_button(bbox_->check_clip);
- // the special section
- igp.special = getString(special_->input_special);
+ // the extra section
+ 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;
+ fl_set_input(extra_->input_rotate_angle, tostr(igp.rotateAngle).c_str());
+
+ int const origin_pos = fl_get_choice(extra_->choice_origin);
+ igp.rotateOrigin = origins_[origin_pos-1];
+
+ igp.subcaption = fl_get_button(extra_->check_subcaption);
+ igp.subcaptionText = getString(extra_->input_subcaption);
+
+ igp.special = getString(extra_->input_special);
}
// the file section
fl_set_input(file_->input_filename, igp.filename.c_str());
- fl_set_button(file_->check_subcaption, igp.subcaption);
- fl_set_input(file_->input_subcaption, igp.subcaptionText.c_str());
- setEnabled(file_->input_subcaption,
- fl_get_button(file_->check_subcaption));
- fl_set_button(file_->check_rotate, igp.rotate);
- fl_set_input(file_->input_rotate_angle,
- tostr(igp.rotateAngle).c_str());
- if (igp.rotateOrigin.empty())
- fl_set_choice(file_->choice_origin,1);
+ fl_set_input(file_->input_lyxscale, tostr(igp.lyxscale).c_str());
+
+ switch (igp.display) {
+ case grfx::NoDisplay: fl_set_choice(file_->choice_display, 5); break;
+ case grfx::ColorDisplay: fl_set_choice(file_->choice_display, 4); break;
+ case grfx::GrayscaleDisplay: fl_set_choice(file_->choice_display, 3); break;
+ case grfx::MonochromeDisplay: fl_set_choice(file_->choice_display, 2); break;
+ case grfx::DefaultDisplay:
+ default: fl_set_choice(file_->choice_display, 1);
+ }
+
+ // disable height input in case of scaling
+ setEnabled(file_->input_height, !igp.scale);
+ setEnabled(file_->choice_height, !igp.scale);
+
+ // set width input fields according to scaling or width/height input
+ if (igp.scale) {
+ fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
+ fl_set_input(file_->input_width, tostr(igp.scale).c_str());
+ fl_set_choice(file_->choice_width, 1);
+ }
else {
- int pos = int(findPos(origins_, igp.rotateOrigin));
- fl_set_choice(file_->choice_origin, pos+1);
+ fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
+ updateWidgetsFromLength(file_->input_width,
+ file_->choice_width, igp.width, defaultUnit);
}
- setEnabled(file_->input_rotate_angle,
- fl_get_button(file_->check_rotate));
- setEnabled(file_->choice_origin,
- fl_get_button(file_->check_rotate));
+ updateWidgetsFromLength(file_->input_height,
+ file_->choice_height, igp.height, defaultUnit);
+
+ fl_set_button(file_->check_aspectratio, igp.keepAspectRatio);
fl_set_button(file_->check_draft, igp.draft);
fl_set_button(file_->check_nounzip, igp.noUnzip);
- // the lyxview section
- switch (igp.display) {
- case InsetGraphicsParams::DEFAULT:
- fl_set_button(lyxview_->radio_pref, 1);
- break;
- case InsetGraphicsParams::MONOCHROME:
- fl_set_button(lyxview_->radio_mono, 1);
- break;
- case InsetGraphicsParams::GRAYSCALE:
- fl_set_button(lyxview_->radio_gray, 1);
- break;
- case InsetGraphicsParams::COLOR:
- fl_set_button(lyxview_->radio_color, 1);
- break;
- case InsetGraphicsParams::NONE:
- fl_set_button(lyxview_->radio_nodisplay, 1);
- break;
- }
- updateWidgetsFromLength(lyxview_->input_lyxwidth,
- lyxview_->choice_lyxwidth, igp.lyxwidth, defaultUnit);
- updateWidgetsFromLength(lyxview_->input_lyxheight,
- lyxview_->choice_lyxheight, igp.lyxheight, defaultUnit);
- fl_set_input(lyxview_->input_lyxscale, tostr(igp.lyxscale).c_str());
- switch (igp.lyxsize_kind) {
- case InsetGraphicsParams::DEFAULT_SIZE: {
- fl_set_button(lyxview_->radio_lyxasis,1);
- setEnabled(lyxview_->input_lyxwidth, 0);
- setEnabled(lyxview_->choice_lyxwidth, 0);
- setEnabled(lyxview_->input_lyxheight, 0);
- setEnabled(lyxview_->choice_lyxheight, 0);
- setEnabled(lyxview_->check_lyxaspectratio, 0);
- setEnabled(lyxview_->input_lyxscale, 0);
- break;
- }
- case InsetGraphicsParams::SCALE: {
- fl_set_button(lyxview_->radio_lyxscale, 1);
- setEnabled(lyxview_->input_lyxwidth, 0);
- setEnabled(lyxview_->choice_lyxwidth, 0);
- setEnabled(lyxview_->input_lyxheight, 0);
- setEnabled(lyxview_->choice_lyxheight, 0);
- setEnabled(lyxview_->input_lyxscale, 1);
- break;
- }
- case InsetGraphicsParams::WH: {
- fl_set_button(lyxview_->radio_lyxwh, 1);
- setEnabled(lyxview_->input_lyxwidth, 1);
- setEnabled(lyxview_->choice_lyxwidth, 1);
- setEnabled(lyxview_->input_lyxheight, 1);
- setEnabled(lyxview_->choice_lyxheight, 1);
- setEnabled(lyxview_->check_lyxaspectratio, 1);
- setEnabled(lyxview_->input_lyxscale, 0);
- break;
- }
- }
- fl_set_button(lyxview_->check_lyxaspectratio, igp.keepLyXAspectRatio);
-
- fl_set_button(lyxview_->check_lyxaspectratio, igp.keepLyXAspectRatio);
-
- // the size section
- // Update the draft and clip mode
- updateWidgetsFromLength(size_->input_width,
- size_->choice_width, igp.width, defaultUnit);
- updateWidgetsFromLength(size_->input_height,
- size_->choice_height, igp.height, defaultUnit);
- fl_set_input(size_->input_scale, tostr(igp.scale).c_str());
- lyxerr[Debug::GRAPHICS] << "FormGraphics::update: igp.size_kind = "
- << igp.size_kind << endl;
- switch (igp.size_kind) {
- case InsetGraphicsParams::DEFAULT_SIZE: {
- fl_set_button(size_->radio_asis,1);
- setEnabled(size_->input_width, 0);
- setEnabled(size_->choice_width, 0);
- setEnabled(size_->input_height, 0);
- setEnabled(size_->choice_height, 0);
- setEnabled(size_->check_aspectratio, 0);
- setEnabled(size_->input_scale, 0);
- break;
- }
- case InsetGraphicsParams::SCALE: {
- fl_set_button(size_->radio_scale, 1);
- setEnabled(size_->input_width, 0);
- setEnabled(size_->choice_width, 0);
- setEnabled(size_->input_height, 0);
- setEnabled(size_->choice_height, 0);
- setEnabled(size_->check_aspectratio, 0);
- setEnabled(size_->input_scale, 1);
- break;
- }
- case InsetGraphicsParams::WH: {
- fl_set_button(size_->radio_wh, 1);
- setEnabled(size_->input_width, 1);
- setEnabled(size_->choice_width, 1);
- setEnabled(size_->input_height, 1);
- setEnabled(size_->choice_height, 1);
- setEnabled(size_->check_aspectratio, 1);
- setEnabled(size_->input_scale, 0);
- break;
- }
- }
- fl_set_button(size_->check_aspectratio, igp.keepAspectRatio);
+ // disable aspectratio button in case of scaling or one of width/height is empty
+ bool const disable_aspectRatio = igp.scale ||
+ getString(file_->input_width).empty() ||
+ getString(file_->input_height).empty();
+ setEnabled(file_->check_aspectratio, !disable_aspectRatio);
// the bb section
// set the bounding box values, if exists. First we need the whole
updateBB(igp.filename, igp.bb);
fl_set_button(bbox_->check_clip, igp.clip);
- // the special section
- fl_set_input(special_->input_special, igp.special.c_str());
+
+ // the extra section
+ fl_set_input(extra_->input_rotate_angle,
+ tostr(igp.rotateAngle).c_str());
+ if (igp.rotateOrigin.empty())
+ fl_set_choice(extra_->choice_origin, 1);
+ else
+ fl_set_choice(extra_->choice_origin,
+ 1 + int(findPos(origins_, igp.rotateOrigin)) );
+ fl_set_button(extra_->check_subcaption, igp.subcaption);
+ fl_set_input(extra_->input_subcaption, igp.subcaptionText.c_str());
+ setEnabled(extra_->input_subcaption,
+ fl_get_button(extra_->check_subcaption));
+ fl_set_input(extra_->input_special, igp.special.c_str());
+
+ // open dialog in the file-tab, whenever filename is empty
+ if (igp.filename.empty()) fl_set_folder(dialog_->tabfolder, file_->form);
}
if (controller().isFilenameValid(out_name) &&
!controller().bbChanged)
updateBB(out_name, string());
+ } else if (ob == file_->input_width || ob == file_->input_height) {
+ // disable aspectratio button in case of scaling or one of width/height is empty
+ bool const disable = fl_get_choice(file_->choice_width) == 1 ||
+ getString(file_->input_width).empty() ||
+ getString(file_->input_height).empty();
+ setEnabled(file_->check_aspectratio, !disable);
+ } else if (ob == file_->choice_width) {
+ // disable height input in case of scaling
+ bool const scaling = fl_get_choice(file_->choice_width) == 1;
+ setEnabled(file_->input_height, !scaling);
+ setEnabled(file_->choice_height, !scaling);
+
+ // allow only integer intput for scaling; float otherwise
+ if (scaling)
+ fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
+ else
+ fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
- } else if (ob == file_->check_subcaption) {
- setEnabled(file_->input_subcaption,
- fl_get_button(file_->check_subcaption));
- } else if (ob == file_->check_rotate) {
- setEnabled(file_->input_rotate_angle,
- fl_get_button(file_->check_rotate));
- setEnabled(file_->choice_origin,
- fl_get_button(file_->check_rotate));
-
- // the lyxview section
- } else if (ob == lyxview_->radio_lyxasis) {
- setEnabled(lyxview_->input_lyxwidth, 0);
- setEnabled(lyxview_->choice_lyxwidth, 0);
- setEnabled(lyxview_->input_lyxheight, 0);
- setEnabled(lyxview_->choice_lyxheight, 0);
- setEnabled(lyxview_->check_lyxaspectratio, 0);
- setEnabled(lyxview_->input_lyxscale, 0);
- } else if (ob == lyxview_->radio_lyxscale) {
- setEnabled(lyxview_->input_lyxwidth, 0);
- setEnabled(lyxview_->choice_lyxwidth, 0);
- setEnabled(lyxview_->input_lyxheight, 0);
- setEnabled(lyxview_->choice_lyxheight, 0);
- setEnabled(lyxview_->check_lyxaspectratio, 0);
- setEnabled(lyxview_->input_lyxscale, 1);
- } else if (ob == lyxview_->radio_lyxwh) {
- setEnabled(lyxview_->input_lyxwidth, 1);
- setEnabled(lyxview_->choice_lyxwidth, 1);
- setEnabled(lyxview_->input_lyxheight, 1);
- setEnabled(lyxview_->choice_lyxheight, 1);
- setEnabled(lyxview_->check_lyxaspectratio, 1);
- setEnabled(lyxview_->input_lyxscale, 0);
- } else if (ob == lyxview_->button_latex_values) {
- if (contains(fl_get_choice_text(size_->choice_width), '%') ||
- contains(fl_get_choice_text(size_->choice_height), '%'))
- Alert::alert(_("Warning!"),
- _("The %-units are not allowed here."),
- _("Cannot use the values from LaTeX size!"));
- else {
- LyXLength dummy =
- getLyXLengthFromWidgets(size_->input_width,
- size_->choice_width);
- updateWidgetsFromLength(lyxview_->input_lyxwidth,
- lyxview_->choice_lyxwidth,
- dummy, defaultUnit);
-
- dummy = getLyXLengthFromWidgets(size_->input_height,
- size_->choice_height);
- updateWidgetsFromLength(lyxview_->input_lyxheight,
- lyxview_->choice_lyxheight,
- dummy, defaultUnit);
- string const scale = getString(size_->input_scale);
- fl_set_input(lyxview_->input_lyxscale, scale.c_str());
- if (fl_get_button (size_->radio_asis) == 1) {
- fl_set_button (lyxview_->radio_lyxasis, 1);
- setEnabled(lyxview_->input_lyxwidth, 0);
- setEnabled(lyxview_->choice_lyxwidth, 0);
- setEnabled(lyxview_->input_lyxheight, 0);
- setEnabled(lyxview_->choice_lyxheight, 0);
- setEnabled(lyxview_->check_lyxaspectratio, 0);
- setEnabled(lyxview_->input_lyxscale, 0);
- } else if (fl_get_button (size_->radio_scale) ==1) {
- fl_set_button (lyxview_->radio_lyxscale, 1);
- setEnabled(lyxview_->input_lyxwidth, 0);
- setEnabled(lyxview_->choice_lyxwidth, 0);
- setEnabled(lyxview_->input_lyxheight, 0);
- setEnabled(lyxview_->choice_lyxheight, 0);
- setEnabled(lyxview_->check_lyxaspectratio, 0);
- setEnabled(lyxview_->input_lyxscale, 1);
- } else if (fl_get_button (size_->radio_wh) == 1) {
- fl_set_button (lyxview_->radio_lyxwh, 1);
- setEnabled(lyxview_->input_lyxwidth, 1);
- setEnabled(lyxview_->choice_lyxwidth, 1);
- setEnabled(lyxview_->input_lyxheight, 1);
- setEnabled(lyxview_->choice_lyxheight, 1);
- setEnabled(lyxview_->check_lyxaspectratio, 1);
- setEnabled(lyxview_->input_lyxscale, 0);
- setEnabled(lyxview_->check_lyxaspectratio, 1);
- }
- }
- fl_set_button(lyxview_->check_lyxaspectratio,
- fl_get_button(size_->check_aspectratio));
- // the bb section
+ // disable aspectratio button in case of scaling or height input is empty
+ bool const disable_aspectratio = scaling || getString(file_->input_height).empty();
+ setEnabled(file_->check_aspectratio, !disable_aspectratio);
+ // the bb section
} else if (!controller().bbChanged &&
(ob == bbox_->check_clip || ob == bbox_->choice_bb_units ||
ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_y0 ||
fl_set_input(bbox_->input_bb_y0, token(bb,' ',1).c_str());
fl_set_input(bbox_->input_bb_x1, token(bb,' ',2).c_str());
fl_set_input(bbox_->input_bb_y1, token(bb,' ',3).c_str());
- string const unit("bp");
- fl_set_choice_text(bbox_->choice_bb_units, unit.c_str());
+ fl_set_choice_text(bbox_->choice_bb_units, "bp");
}
controller().bbChanged = false;
} else {
fl_set_input(bbox_->input_bb_y1, "");
fl_set_choice_text(bbox_->choice_bb_units, "bp");
}
+ // the extra section
+ } else if (ob == extra_->check_subcaption) {
+ setEnabled(extra_->input_subcaption,
+ fl_get_button(extra_->check_subcaption));
- // the size section
- } else if (ob == size_->radio_asis) {
- setEnabled(size_->input_width, 0);
- setEnabled(size_->choice_width, 0);
- setEnabled(size_->input_height, 0);
- setEnabled(size_->choice_height, 0);
- setEnabled(size_->check_aspectratio, 0);
- setEnabled(size_->input_scale, 0);
- } else if (ob == size_->radio_scale) {
- setEnabled(size_->input_width, 0);
- setEnabled(size_->choice_width, 0);
- setEnabled(size_->input_height, 0);
- setEnabled(size_->choice_height, 0);
- setEnabled(size_->check_aspectratio, 0);
- setEnabled(size_->input_scale, 1);
- } else if (ob == size_->radio_wh) {
- setEnabled(size_->input_width, 1);
- setEnabled(size_->choice_width, 1);
- setEnabled(size_->input_height, 1);
- setEnabled(size_->choice_height, 1);
- setEnabled(size_->check_aspectratio, 1);
- setEnabled(size_->input_scale, 0);
- } else if (ob == size_->button_lyx_values) {
- LyXLength dummy = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
- lyxview_->choice_lyxwidth);
- updateWidgetsFromLength(size_->input_width,
- size_->choice_width,
- dummy, defaultUnit);
- dummy = getLyXLengthFromWidgets(lyxview_->input_lyxheight,
- lyxview_->choice_lyxheight);
- updateWidgetsFromLength(size_->input_height,
- size_->choice_height,
- dummy, defaultUnit);
- string const scale = getString(lyxview_->input_lyxscale);
- fl_set_input(size_->input_scale, scale.c_str());
- if (fl_get_button (lyxview_->radio_lyxasis) == 1) {
- fl_set_button (size_->radio_asis, 1);
- setEnabled(size_->input_width, 0);
- setEnabled(size_->choice_width, 0);
- setEnabled(size_->input_height, 0);
- setEnabled(size_->choice_height, 0);
- setEnabled(size_->check_aspectratio, 0);
- setEnabled(size_->input_scale, 0);
- } else if (fl_get_button (lyxview_->radio_lyxscale) ==1) {
- fl_set_button (size_->radio_scale, 1);
- setEnabled(size_->input_width, 0);
- setEnabled(size_->choice_width, 0);
- setEnabled(size_->input_height, 0);
- setEnabled(size_->choice_height, 0);
- setEnabled(size_->check_aspectratio, 0);
- setEnabled(size_->input_scale, 1);
- } else if (fl_get_button (lyxview_->radio_lyxwh) == 1) {
- fl_set_button (size_->radio_wh, 1);
- setEnabled(size_->input_width, 1);
- setEnabled(size_->choice_width, 1);
- setEnabled(size_->input_height, 1);
- setEnabled(size_->choice_height, 1);
- setEnabled(size_->check_aspectratio, 1);
- setEnabled(size_->input_scale, 0);
- }
- fl_set_button(size_->check_aspectratio,
- fl_get_button(lyxview_->check_lyxaspectratio));
}
- // check if the input is valid
- bool invalid = !isValid(bbox_->input_bb_x0);
- invalid = invalid || !isValid(bbox_->input_bb_x1);
- invalid = invalid || !isValid(bbox_->input_bb_y0);
- invalid = invalid || !isValid(bbox_->input_bb_y1);
- invalid = invalid || !isValid(size_->input_width);
- invalid = invalid || !isValid(size_->input_height);
- invalid = invalid || !isValid(lyxview_->input_lyxwidth);
- invalid = invalid || !isValid(lyxview_->input_lyxheight);
-
// deactivate OK/ Apply buttons and
// spit out warnings if invalid
if (ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_x1 ||
ob == bbox_->input_bb_y0 || ob == bbox_->input_bb_y1 ||
- ob == size_->input_width || ob == size_->input_height ||
- ob == lyxview_->input_lyxwidth || ob == lyxview_->input_lyxheight) {
- if (invalid) {
+ ob == file_->input_width || ob == file_->input_height) {
+ if (isValid(ob))
+ clearMessage();
+ else {
postWarning(_("Invalid Length!"));
return ButtonPolicy::SMI_INVALID;
- } else {
- clearMessage();
}
}
class ControlGraphics;
struct FD_graphics;
struct FD_graphics_file;
-struct FD_graphics_lyxview;
-struct FD_graphics_size;
struct FD_graphics_bbox;
-struct FD_graphics_special;
+struct FD_graphics_extra;
/** This class provides an XForms implementation of the Graphics Dialog.
*/
/// Real GUI implementation.
boost::scoped_ptr<FD_graphics_file> file_;
///
- boost::scoped_ptr<FD_graphics_lyxview> lyxview_;
- ///
- boost::scoped_ptr<FD_graphics_size> size_;
- ///
boost::scoped_ptr<FD_graphics_bbox> bbox_;
///
- boost::scoped_ptr<FD_graphics_special> special_;
+ boost::scoped_ptr<FD_graphics_extra> extra_;
/// Store the LaTeX names for the rotation origins.
std::vector<string> origins_;
string const old_value = lyxrc.display_graphics;
if (fl_get_button(dialog_->radio_display_monochrome)) {
- lyxrc.display_graphics = "mono";
+ lyxrc.display_graphics = "monochrome";
} else if (fl_get_button(dialog_->radio_display_grayscale)) {
- lyxrc.display_graphics = "gray";
+ lyxrc.display_graphics = "grayscale";
} else if (fl_get_button(dialog_->radio_display_color)) {
lyxrc.display_graphics = "color";
} else {
- lyxrc.display_graphics = "no";
+ lyxrc.display_graphics = "none";
}
#ifdef WITH_WARNINGS
fl_set_counter_value(dialog_->counter_autosave, lyxrc.autosave);
fl_set_counter_value(dialog_->counter_wm_jump, lyxrc.wheel_jump);
- if (lyxrc.display_graphics == "mono") {
+ if (lyxrc.display_graphics == "monochrome") {
fl_set_button(dialog_->radio_display_monochrome, 1);
- } else if (lyxrc.display_graphics == "gray") {
+ } else if (lyxrc.display_graphics == "grayscale") {
fl_set_button(dialog_->radio_display_grayscale, 1);
} else if (lyxrc.display_graphics == "color") {
fl_set_button(dialog_->radio_display_color, 1);
Internal Form Definition File
(do not change)
-Number of forms: 6
+Number of forms: 4
Unit of measure: FL_COORD_PIXEL
SnapGrid: 5
--------------------
class: FL_TEXT
type: NORMAL_TEXT
-box: 5 280 495 25
+box: 5 280 500 25
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
lcol: FL_BLACK
label:
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
name: text_warning
callback: C_FormBaseInputCB
Name: form_graphics_file
Width: 500
Height: 245
-Number of Objects: 13
+Number of Objects: 15
--------------------
class: FL_BOX
callback:
argument:
+--------------------
+class: FL_LABELFRAME
+type: ENGRAVED_FRAME
+box: 10 130 480 105
+boxtype: FL_NO_BOX
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Output
+shortcut:
+resize: FL_RESIZE_NONE
+gravity: FL_NoGravity FL_NoGravity
+name:
+callback:
+argument:
+
--------------------
class: FL_INPUT
type: NORMAL_INPUT
lcol: FL_BLACK
label: Browse...|#B
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
name: button_browse
callback: C_FormBaseInputCB
--------------------
class: FL_LABELFRAME
type: ENGRAVED_FRAME
-box: 10 55 480 60
+box: 10 60 480 60
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT
-style: FL_BOLD_STYLE
+style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label:
+label: LyX View
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
name:
callback:
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 15 70 30 30
+box: 315 145 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Subfigure|#S
+label: Draft mode|#m
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: check_subcaption
+name: check_draft
callback: C_FormBaseInputCB
argument: 0
--------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 190 70 290 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 315 180 30 30
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Title|#T
+label: Don't unzip, when\nexporting to LaTeX|#u
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: input_subcaption
+name: check_nounzip
callback: C_FormBaseInputCB
argument: 0
--------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 10 115 480 60
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_BOLD_STYLE
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 95 75 70 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label:
+label: Scale|#S
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
+name: input_lyxscale
+callback: C_FormBaseInputCB
+argument: 0
--------------------
class: FL_INPUT
-type: INT_INPUT
-box: 190 130 55 30
+type: NORMAL_INPUT
+box: 95 145 70 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Angle|#A
+label: Width|#W
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: input_rotate_angle
+name: input_width
callback: C_FormBaseInputCB
argument: 0
--------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 245 130 38 30
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 165 145 50 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: deg
+label:
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
+name: choice_width
+callback: C_FormBaseInputCB
+argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 360 130 118 28
+box: 165 175 50 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Origin|#O
+label:
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: choice_origin
+name: choice_height
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 15 195 30 30
+box: 95 205 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Draft mode|#D
+label: keep Aspect ratio|#A
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: check_draft
+name: check_aspectratio
callback: C_FormBaseInputCB
argument: 0
--------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 15 130 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 95 175 70 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Rotate|#R
+label: Height|#H
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: check_rotate
+name: input_height
callback: C_FormBaseInputCB
argument: 0
--------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 175 195 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
+class: FL_TEXT
+type: NORMAL_TEXT
+box: 165 75 30 30
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
+style: FL_NORMAL_STYLE
+size: FL_MEDIUM_SIZE
+lcol: FL_BLACK
+label: %
+shortcut:
+resize: FL_RESIZE_NONE
+gravity: FL_NoGravity FL_NoGravity
+name:
+callback:
+argument:
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 315 75 115 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Don't unzip, when exporting to LaTeX|#u
+label: Display|#D
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: check_nounzip
+name: choice_display
callback: C_FormBaseInputCB
argument: 0
=============== FORM ===============
-Name: form_graphics_size
+Name: form_graphics_bbox
Width: 500
Height: 245
-Number of Objects: 16
+Number of Objects: 10
--------------------
class: FL_BOX
argument:
--------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 355 10 135 50
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 10 10 480 225
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 135 55 50 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Output size
+label: Right top|#R
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
+name: input_bb_x1
+callback: C_FormBaseInputCB
+argument: 0
--------------------
-class: FL_BEGIN_GROUP
-type: 0
-box: 0 10 10 0
-boxtype: FL_NO_BOX
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 190 55 50 30
+boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER
+alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label:
shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 25 30 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Original size|#O
-shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: radio_asis
+name: input_bb_y1
callback: C_FormBaseInputCB
argument: 0
--------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 25 80 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 135 90 50 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Scale|#S
+label: Left bottom|#L
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: radio_scale
+name: input_bb_x0
callback: C_FormBaseInputCB
argument: 0
--------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 25 130 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 190 90 50 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Custom|#C
+label:
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: radio_wh
+name: input_bb_y0
callback: C_FormBaseInputCB
argument: 0
--------------------
-class: FL_END_GROUP
-type: 0
-box: 0 0 0 0
-boxtype: FL_NO_BOX
+class: FL_TEXT
+type: NORMAL_TEXT
+box: 145 30 30 25
+boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER
+alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label:
+label: X
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 200 80 85 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Value|#V
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_scale
-callback: C_FormBaseInputCB
-argument: 0
-
--------------------
class: FL_TEXT
type: NORMAL_TEXT
-box: 285 80 25 30
+box: 200 30 30 25
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
+alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: %
+label: Y
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 200 130 85 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Width|#W
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_width
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 290 130 60 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: choice_width
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 200 165 85 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Height|#H
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_height
-callback: C_FormBaseInputCB
-argument: 0
-
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 290 165 60 30
+box: 260 70 45 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
+alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label:
+label: Units|#U
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: choice_height
+name: choice_bb_units
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 200 200 30 30
+box: 45 165 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: keep Aspect ratio|#A
+label: Clip to bounding box|#C
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: check_aspectratio
+name: check_clip
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
-box: 365 20 115 30
+box: 305 165 125 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Get LyX size|#L
+label: Get from file|#G
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: button_lyx_values
+name: button_getBB
callback: C_FormBaseInputCB
argument: 0
=============== FORM ===============
-Name: form_graphics_bbox
+Name: form_graphics_extra
Width: 500
Height: 245
-Number of Objects: 11
+Number of Objects: 8
--------------------
class: FL_BOX
callback:
argument:
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 10 10 480 180
-boxtype: FL_UP_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Corner coordinates (X, Y)
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 195 110 30 25
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: ,
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 195 55 30 25
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: ,
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 150 45 50 30
+box: 120 170 370 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Top right ( |#T
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_bb_x1
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 220 45 50 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_RIGHT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: )
+label: LaTeX options|#L
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: input_bb_y1
+name: input_special
callback: C_FormBaseInputCB
argument: 0
--------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 150 95 50 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
+class: FL_LABELFRAME
+type: ENGRAVED_FRAME
+box: 10 15 480 60
+boxtype: FL_NO_BOX
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Bottom left ( |#B
+label: Rotation
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: input_bb_x0
-callback: C_FormBaseInputCB
-argument: 0
+name:
+callback:
+argument:
--------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 220 95 50 30
-boxtype: FL_DOWN_BOX
+class: FL_TEXT
+type: NORMAL_TEXT
+box: 155 30 38 30
+boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_RIGHT
+alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: )
+label: deg
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: input_bb_y0
-callback: C_FormBaseInputCB
-argument: 0
+name:
+callback:
+argument:
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 350 70 45 30
+box: 300 30 118 28
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Units|#U
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: choice_bb_units
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 20 150 165 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Get values from file|#G
+label: Origin|#O
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: button_getBB
+name: choice_origin
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 20 200 30 30
+box: 10 115 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Clip to bounding box|#C
+label: Subfigure|#S
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name: check_clip
+name: check_subcaption
callback: C_FormBaseInputCB
argument: 0
-=============== FORM ===============
-Name: form_graphics_special
-Width: 500
-Height: 245
-Number of Objects: 2
-
---------------------
-class: FL_BOX
-type: FLAT_BOX
-box: 0 0 500 245
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
--------------------
class: FL_INPUT
-type: NORMAL_INPUT
-box: 190 40 265 30
+type: INT_INPUT
+box: 100 30 55 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Additional LaTeX options|#L
+label: Angle|#A
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: input_special
+name: input_rotate_angle
callback: C_FormBaseInputCB
argument: 0
-=============== FORM ===============
-Name: form_graphics_lyxview
-Width: 500
-Height: 245
-Number of Objects: 24
-
---------------------
-class: FL_BOX
-type: FLAT_BOX
-box: 0 0 500 245
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
--------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 155 10 335 225
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 120 115 370 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Screen size
+label:
shortcut:
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 355 10 135 50
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 10 10 145 225
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Screen display
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 350 75 70 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Value|#V
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_lyxscale
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_BEGIN_GROUP
-type: 0
-box: 0 10 10 0
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 170 25 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Original size|#O
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_lyxasis
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 170 75 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Scale|#S
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_lyxscale
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 170 140 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Custom|#u
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_lyxwh
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_END_GROUP
-type: 0
-box: 0 0 0 0
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 420 75 25 30
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: %
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_BEGIN_GROUP
-type: 0
-box: 0 10 10 0
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 20 25 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Default|#f
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_pref
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 20 65 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Monochrome|#M
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_mono
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 20 105 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Grayscale|#G
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_gray
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 20 145 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Color|#C
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_color
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 20 185 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Don't display|#D
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_nodisplay
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_END_GROUP
-type: 0
-box: 0 0 0 0
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 350 135 70 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Width|#W
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_lyxwidth
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 425 135 50 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: choice_lyxwidth
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 350 170 70 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Height|#H
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_lyxheight
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 425 170 50 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: choice_lyxheight
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 365 20 115 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Get LaTeX size|#L
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: button_latex_values
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 210 200 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: keep Aspect ratio|#A
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: check_lyxaspectratio
+name: input_subcaption
callback: C_FormBaseInputCB
argument: 0
// Bounds are unchanged.
return;
- int const xoffset_l = std::max(0, params.bb.xl);
- int const xoffset_r = std::max(0, image_->w - params.bb.xr);
- int const yoffset_t = std::max(0, image_->h - params.bb.yt);
- int const yoffset_b = std::max(0, params.bb.yb);
+ // FIXME: these values are unsigned so this makes NO sense
+
+ int const xoffset_l = std::max(0U, params.bb.xl);
+ int const xoffset_r = std::max(0U, image_->w - params.bb.xr);
+ int const yoffset_t = std::max(0U, image_->h - params.bb.yt);
+ int const yoffset_b = std::max(0U, params.bb.yb);
flimage_crop(image_, xoffset_l, yoffset_t, xoffset_r, yoffset_b);
}
+2002-08-23 Rob Lahaye <lahaye@snu.ac.kr>
+
+ * GraphicsImage.C:
+ * GraphicsParams.[Ch]: remove keepLyXAspectRatio, width and height
+ because this input has gone from the graphics dialog.
+
+ * GraphicsTypes.h: add enum DisplayType DefaultDisplay
+
2002-08-20 Lars Gullik Bjønnes <larsbj@birdstep.com>
* GraphicsImageXPM.h: inlcude boost/shared_ptr.hpp, remove include
std::pair<unsigned int, unsigned int>
Image::getScaledDimensions(Params const & params) const
{
+ unsigned int width = getWidth();
+ unsigned int height = getHeight();
+
+ // scale only when value makes sense, i.e. not zero
+ if (params.scale) {
+ width = (width * params.scale) / 100;
+ height = (height * params.scale) / 100;
+ }
+
lyxerr[Debug::GRAPHICS]
<< "GraphicsImage::getScaledDImensions()"
<< "\n\tparams.scale : " << params.scale
- << "\n\tparams.width : " << params.width
- << "\n\tparams.height : " << params.height
- << "\n\tkeepLyXAspectRatio : " << params.keepLyXAspectRatio
+ << "\n\twidth : " << width
+ << "\n\theight : " << height
<< std::endl;
- if (params.width == 0 && params.height == 0 && params.scale == 0) {
- // original size or scale/custom without any input
- lyxerr[Debug::GRAPHICS]
- << "\treturn with the original values!\n";
- return std::make_pair(getWidth(), getHeight());
- }
-
- typedef unsigned int dimension;
- dimension width = 0;
- dimension height = 0;
- if (params.scale != 0) {
- // GraphicsParams::Scale
- width = dimension(double(getWidth()) * params.scale / 100.0);
- height = dimension(getHeight() * params.scale / 100.0);
- return std::make_pair(width, height);
- }
- // GraphicsParams::WH
- width = (params.width > 0) ? params.width : getWidth();
- height = (params.height > 0) ? params.height : getHeight();
- if (!params.keepLyXAspectRatio)
- return std::make_pair(width, height);
- // calculate aspect ratio
- float const rw = getWidth();
- float const rh = getHeight();
- // there must be a width for the division
- float const ratio = (rw > 0.001) ? rh/rw : 1.0;
- lyxerr[Debug::GRAPHICS]
- << "\tValue of LyXAspectRatio: " << ratio << std::endl;
- // there are now four different cases
- // w=0 & h=0 -> see above, no more possible at this place
- // w>0 & h=0 -> calculate h
- // w=0 & h>0 -> calculate w
- // w>0 & h>0 -> the greatest difference to the original
- // value becomes the same
- if (params.width > 0 && params.height > 0) {
- // both widths are given and keepAspectRatio, too
- int const diff_width = abs(int(getWidth() - params.width));
- int const diff_height= abs(int(getHeight() - params.height));
- if (diff_width > diff_height)
- height = int(ratio * params.width);
- else
- width = int(ratio * params.height);
- return std::make_pair(width, height);
- }
- if (params.width > 0) {
- width = params.width;
- height = int(ratio * params.width);
- return std::make_pair(width, height);
- }
- if (params.height > 0) {
- height = params.height;
- width = int(ratio * params.height);
- return std::make_pair(width, height);
- }
- // all other cases ... kind of paranoia :-)
- return std::make_pair(getWidth(), getHeight());
+ return std::make_pair(width, height);
}
} // namespace grfx
Params::Params()
: display(ColorDisplay),
- width(0),
- height(0),
- scale(0),
- keepLyXAspectRatio(false),
+ scale(100),
angle(0)
{}
bool operator==(Params const & a, Params const & b)
{
- return (a.filename == b.filename &&
- a.display == b.display &&
- a.bb == b.bb &&
- a.width == b.width &&
- a.height == b.height &&
- a.scale == b.scale &&
- a.keepLyXAspectRatio == b.keepLyXAspectRatio &&
- a.angle == b.angle);
+ return (a.filename == b.filename &&
+ a.display == b.display &&
+ a.bb == b.bb &&
+ a.scale == b.scale &&
+ a.angle == b.angle);
}
// inBP returns the length in Postscript points.
// Note further that there are 72 Postscript pixels per inch.
- int const xl_tmp = abs(LyXLength(a).inBP());
- int const yb_tmp = abs(LyXLength(b).inBP());
- int const xr_tmp = abs(LyXLength(c).inBP());
- int const yt_tmp = abs(LyXLength(d).inBP());
+ unsigned int const xl_tmp = abs(LyXLength(a).inBP());
+ unsigned int const yb_tmp = abs(LyXLength(b).inBP());
+ unsigned int const xr_tmp = abs(LyXLength(c).inBP());
+ unsigned int const yt_tmp = abs(LyXLength(d).inBP());
if (xr_tmp <= xl_tmp || yt_tmp <= yb_tmp)
return;
/// 0 0 0 0 is empty!
bool empty() const;
- int xl;
- int yb;
- int xr;
- int yt;
+ unsigned int xl;
+ unsigned int yb;
+ unsigned int xr;
+ unsigned int yt;
};
bool operator==(BoundingBox const &, BoundingBox const &);
Params();
DisplayType display;
+ unsigned int scale;
/// The image filename.
string filename;
/** The size of the view inside lyx in pixels or the scaling of the
* image.
*/
- unsigned int width;
- unsigned int height;
- unsigned int scale;
- bool keepLyXAspectRatio;
-
/// Rotation angle.
- int angle;
+ float angle;
};
bool operator==(Params const &, Params const &);
/// How is the image to be displayed on the LyX screen?
enum DisplayType {
///
- ColorDisplay,
+ DefaultDisplay,
+ ///
+ MonochromeDisplay,
///
GrayscaleDisplay,
///
- MonochromeDisplay,
+ ColorDisplay,
///
NoDisplay
};
bool InsetFootlike::insetAllowed(Inset::Code code) const
{
if ((code == Inset::FOOT_CODE) || (code == Inset::MARGIN_CODE)
- || (code ==Inset::FLOAT_CODE))
+ || (code == Inset::FLOAT_CODE))
return false;
return InsetCollapsable::insetAllowed(code);
}
void InsetGraphics::write(Buffer const *, ostream & os) const
{
- os << "Graphics FormatVersion " << VersionNumber << '\n';
+ os << "Graphics\n";
params().Write(os);
}
if (token == "Graphics")
readInsetGraphics(lex);
- else if (token == "Figure") // Compatibility reading of FigInset figures.
- readFigInset(lex);
else
- lyxerr[Debug::GRAPHICS] << "Not a Graphics or Figure inset!\n";
+ lyxerr[Debug::GRAPHICS] << "Not a Graphics inset!\n";
cache_->update(MakeAbsPath(params().filename, buf->filePath()));
}
}
}
-// FormatVersion < 1.0 (LyX < 1.2)
-void InsetGraphics::readFigInset(LyXLex & lex)
-{
- std::vector<string> const oldUnitsWidth =
- getVectorFromString("pt, cm, in, text%, col%");
- std::vector<string> const oldUnitsHeight =
- getVectorFromString("pt, cm, in, theight%");
- bool finished = false;
- // set the display default
- if (lyxrc.display_graphics == "mono")
- params_.display = InsetGraphicsParams::MONOCHROME;
- else if (lyxrc.display_graphics == "gray")
- params_.display = InsetGraphicsParams::GRAYSCALE;
- else if (lyxrc.display_graphics == "color")
- params_.display = InsetGraphicsParams::COLOR;
- else
- params_.display = InsetGraphicsParams::NONE;
- while (lex.isOK() && !finished) {
- lex.next();
-
- string const token = lex.getString();
- lyxerr[Debug::GRAPHICS] << "Token: " << token << endl;
-
- if (token.empty())
- continue;
- else if (token == "\\end_inset") {
- finished = true;
- } else if (token == "file") {
- if (lex.next()) {
- params_.filename = lex.getString();
- }
- } else if (token == "extra") {
- if (lex.next());
- // kept for backwards compability. Delete in 0.13.x
- } else if (token == "subcaption") {
- if (lex.eatLine())
- params_.subcaptionText = lex.getString();
- } else if (token == "label") {
- if (lex.next());
- // kept for backwards compability. Delete in 0.13.x
- } else if (token == "angle") {
- if (lex.next()) {
- params_.rotate = true;
- params_.rotateAngle = lex.getFloat();
- }
- } else if (token == "size") {
- if (lex.next())
- params_.lyxwidth = LyXLength(lex.getString()+"pt");
- if (lex.next())
- params_.lyxheight = LyXLength(lex.getString()+"pt");
- params_.lyxsize_kind = InsetGraphicsParams::WH;
- } else if (token == "flags") {
- if (lex.next())
- switch (lex.getInteger()) {
- case 1: params_.display = InsetGraphicsParams::MONOCHROME;
- break;
- case 2: params_.display = InsetGraphicsParams::GRAYSCALE;
- break;
- case 3: params_.display = InsetGraphicsParams::COLOR;
- break;
- case 8: params_.display = InsetGraphicsParams::NONE;
- break;
- }
- } else if (token == "subfigure") {
- params_.subcaption = true;
- } else if (token == "width") {
- if (lex.next()) {
- int i = lex.getInteger();
- if (lex.next()) {
- if (i == 5) {
- params_.scale = lex.getInteger();
- params_.size_kind = InsetGraphicsParams::SCALE;
- } else {
- string const value = lex.getString();
- lyxerr[Debug::GRAPHICS] << "readFiginset::oldWidth: "
- << value << oldUnitsWidth[i] << endl;
- params_.width = LyXLength(value + oldUnitsWidth[i]);
- lyxerr[Debug::GRAPHICS] << "readFiginset::newWidth: "
- << params_.width.asString() << endl;
- params_.size_kind = InsetGraphicsParams::WH;
- }
- }
- }
- } else if (token == "height") {
- if (lex.next()) {
- int i = lex.getInteger();
- if (lex.next()) {
- string const value = lex.getString();
- lyxerr[Debug::GRAPHICS] << "readFiginset::oldHeight: "
- << value << oldUnitsHeight[i] << endl;
- params_.height = LyXLength(value + oldUnitsHeight[i]);
- lyxerr[Debug::GRAPHICS] << "readFiginset::newHeight: "
- << params_.height.asString() << endl;
- params_.size_kind = InsetGraphicsParams::WH;
- }
- }
- }
- }
-}
string const InsetGraphics::createLatexOptions() const
{
options << " draft,\n";
if (params().clip)
options << " clip,\n";
- if (params().size_kind == InsetGraphicsParams::WH) {
- if (!params().width.zero())
- options << " width=" << params().width.asLatexString() << ",\n";
- if (!params().height.zero())
- options << " height=" << params().height.asLatexString() << ",\n";
- } else if (params().size_kind == InsetGraphicsParams::SCALE) {
- if (params().scale > 0)
- options << " scale=" << double(params().scale)/100.0 << ",\n";
+
+ if (params().scale) {
+ if (params().scale != 100)
+ options << " scale=" << params().scale / 100.0 << ",\n";
+ } else {
+ if (!params().width.zero())
+ options << " width=" << params().width.asLatexString() << ",\n";
+ if (!params().height.zero())
+ options << " height=" << params().height.asLatexString() << ",\n";
+ if (params().keepAspectRatio)
+ options << " keepaspectratio,\n";
}
- if (params().keepAspectRatio)
- options << " keepaspectratio,\n";
- // Make sure it's not very close to zero, a float can be effectively
- // zero but not exactly zero.
- if (!lyx::float_equal(params().rotateAngle, 0, 0.001) && params().rotate) {
+
+ // Make sure rotation angle is not very close to zero;
+ // a float can be effectively zero but not exactly zero.
+ if (!lyx::float_equal(params().rotateAngle, 0, 0.001)) {
options << " angle=" << params().rotateAngle << ",\n";
if (!params().rotateOrigin.empty()) {
options << " origin=" << params().rotateOrigin[0];
options << ",\n";
}
}
+
if (!params().special.empty())
options << params().special << ",\n";
+
string opts = options.str().c_str();
return opts.substr(0,opts.size()-2); // delete last ",\n"
}
/// Read the inset native format
void readInsetGraphics(LyXLex & lex);
- /// Read the FigInset file format
- void readFigInset(LyXLex & lex);
/// Get the status message, depends on the image loading status.
string const statusMessage() const;
/// This is the translator between the Display enum and corresponding lyx
/// file strings.
-Translator< InsetGraphicsParams::DisplayType, string >
-displayTranslator(InsetGraphicsParams::DEFAULT, "default");
+Translator< grfx::DisplayType, string >
+displayTranslator(grfx::DefaultDisplay, "default");
} // namespace anon
if (! translatorsSet) {
translatorsSet = true;
// Fill the display translator
- displayTranslator.addPair(DEFAULT, "default");
- displayTranslator.addPair(MONOCHROME, "monochrome");
- displayTranslator.addPair(GRAYSCALE, "grayscale");
- displayTranslator.addPair(COLOR, "color");
- displayTranslator.addPair(NONE, "none");
+ displayTranslator.addPair(grfx::DefaultDisplay, "default");
+ displayTranslator.addPair(grfx::MonochromeDisplay, "monochrome");
+ displayTranslator.addPair(grfx::GrayscaleDisplay, "grayscale");
+ displayTranslator.addPair(grfx::ColorDisplay, "color");
+ displayTranslator.addPair(grfx::NoDisplay, "none");
+
+ // backward compatibility for old lyxrc.display_graphics
+ displayTranslator.addPair(grfx::MonochromeDisplay, "mono");
+ displayTranslator.addPair(grfx::GrayscaleDisplay, "gray");
+ displayTranslator.addPair(grfx::NoDisplay, "no");
}
}
-
InsetGraphicsParams::InsetGraphicsParams(InsetGraphicsParams const & igp)
{
// I decided to skip the initialization since the copy will overwrite
void InsetGraphicsParams::init()
{
subcaptionText = filename = string();
- bb = string(); // bounding box
- draft = false; // draft mode
- clip = false; // clip image
- display = DEFAULT; // see pref
- subcaption = false; // subfigure
- noUnzip = false; // unzip files
- width = LyXLength(); // set to 0pt
+ lyxscale = 100; // lyx scaling in percentage
+ display = grfx::DefaultDisplay; // see pref
+ scale = 100; // output scaling in percentage
+ width = LyXLength();
height = LyXLength();
- lyxwidth = LyXLength(); // for the view in lyx
- lyxheight = LyXLength(); // also set to 0pt
- scale = 0; // unit is %
- lyxscale = 0; // same for lyxview
- size_kind = DEFAULT_SIZE; // do nothing
- lyxsize_kind = DEFAULT_SIZE; // do nothing
keepAspectRatio = false; // for latex
- keepLyXAspectRatio = false; // for lyx
- rotate = false; // Rotating
+ draft = false; // draft mode
+ noUnzip = false; // unzip files
+
+ bb = string(); // bounding box
+ clip = false; // clip image
+
rotateOrigin = "leftBaseline"; // Origin
rotateAngle = 0.0; // in degrees
+ subcaption = false; // subfigure
+ subcaptionText = string(); // subfigure caption
special = string(); // userdefined stuff
}
void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
{
filename = igp.filename;
- bb = igp.bb;
- draft = igp.draft;
- clip = igp.clip;
+ lyxscale = igp.lyxscale;
display = igp.display;
- subcaption = igp.subcaption;
- subcaptionText = igp.subcaptionText;
- noUnzip = igp.noUnzip;
- keepAspectRatio = igp.keepAspectRatio;
+ scale = igp.scale;
width = igp.width;
height = igp.height;
- scale = igp.scale;
- size_kind = igp.size_kind;
- lyxsize_kind = igp.lyxsize_kind;
- lyxwidth = igp.lyxwidth;
- lyxheight = igp.lyxheight;
- keepLyXAspectRatio = igp.keepLyXAspectRatio;
- lyxscale = igp.lyxscale;
- keepLyXAspectRatio = igp.keepLyXAspectRatio;
- rotate = igp.rotate;
- rotateOrigin = igp.rotateOrigin;
+ keepAspectRatio = igp.keepAspectRatio;
+ draft = igp.draft;
+ noUnzip = igp.noUnzip;
+
+ bb = igp.bb;
+ clip = igp.clip;
+
rotateAngle = igp.rotateAngle;
+ rotateOrigin = igp.rotateOrigin;
+ subcaption = igp.subcaption;
+ subcaptionText = igp.subcaptionText;
special = igp.special;
}
InsetGraphicsParams const & right)
{
if (left.filename == right.filename &&
- left.bb == right.bb &&
- left.draft == right.draft &&
- left.clip == right.clip &&
+ left.lyxscale == right.lyxscale &&
left.display == right.display &&
- left.subcaption == right.subcaption &&
- left.noUnzip == right.noUnzip &&
- left.subcaptionText == right.subcaptionText &&
- left.keepAspectRatio == right.keepAspectRatio &&
+ left.scale == right.scale &&
left.width == right.width &&
left.height == right.height &&
- left.scale == right.scale &&
- left.size_kind == right.size_kind &&
- left.lyxsize_kind == right.lyxsize_kind &&
- left.lyxwidth == right.lyxwidth &&
- left.lyxheight == right.lyxheight &&
- left.keepLyXAspectRatio == right.keepLyXAspectRatio &&
- left.lyxscale == right.lyxscale &&
- left.keepLyXAspectRatio == right.keepLyXAspectRatio &&
- left.rotate == right.rotate &&
+ left.keepAspectRatio == right.keepAspectRatio &&
+ left.draft == right.draft &&
+ left.noUnzip == right.noUnzip &&
+
+
+ left.bb == right.bb &&
+ left.clip == right.clip &&
+
+ lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001) &&
left.rotateOrigin == right.rotateOrigin &&
- lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 &&
- left.special == right.special)
- )
+ left.subcaption == right.subcaption &&
+ left.subcaptionText == right.subcaptionText &&
+ left.special == right.special
+ )
return true;
return false;
return !(left == right);
}
-
-namespace {
-
-InsetGraphicsParams::sizeKind getSizeKind(string const & str_in)
-{
- if (str_in == "width_height")
- return InsetGraphicsParams::WH;
- if (str_in == "scale")
- return InsetGraphicsParams::SCALE;
-
- // all other like "original"
- return InsetGraphicsParams::DEFAULT_SIZE;
-}
-
-
-string const getSizeKindStr(InsetGraphicsParams::sizeKind sK_in)
-{
- if (sK_in == InsetGraphicsParams::SCALE)
- return "scale";
- if (sK_in == InsetGraphicsParams::WH)
- return "width_height";
-
- // all other like DEFAULT_SIZE"
- return "original";
-}
-
-// compatibility-stuff 1.20->1.3.0
-InsetGraphicsParams::sizeKind getSizeKind(int type)
-{
- switch (type) {
- case 1:
- return InsetGraphicsParams::WH;
-
- case 2:
- return InsetGraphicsParams::SCALE;
-
- case 0:
- default:
- return InsetGraphicsParams::DEFAULT_SIZE;
- }
-}
-
-} //anon
-
-
void InsetGraphicsParams::Write(ostream & os) const
{
- // If there is no filename, write nothing for it.
+ // Do not write the default values
+
if (!filename.empty()) {
os << "\tfilename " << filename << '\n';
}
+ if (lyxscale != 100)
+ os << "\tlyxscale " << lyxscale << '\n';
+ if (display != grfx::DefaultDisplay)
+ os << "\tdisplay " << displayTranslator.find(display) << '\n';
+ if (scale) {
+ if (scale != 100)
+ os << "\tscale " << scale << '\n';
+ } else {
+ if (!width.zero())
+ os << "\twidth " << width.asString() << '\n';
+ }
+
+ if (!height.zero())
+ os << "\theight " << height.asString() << '\n';
+ if (keepAspectRatio)
+ os << "\tkeepAspectRatio\n";
+ if (draft) // draft mode
+ os << "\tdraft\n";
+ if (noUnzip)
+ os << "\tnoUnzip\n";
+
if (!bb.empty()) // bounding box
os << "\tBoundingBox " << bb << '\n';
if (clip) // clip image
os << "\tclip\n";
- if (draft) // draft mode
- os << "\tdraft\n";
- // Save the display type for the view inside lyx
- os << "\tdisplay " << displayTranslator.find(display) << '\n';
- // Save the subcaption status
+
+ if (rotateAngle != 0.0)
+ os << "\trotateAngle " << rotateAngle << '\n';
+ if (rotateOrigin != "leftBaseline")
+ os << "\trotateOrigin " << rotateOrigin << '\n';
if (subcaption)
os << "\tsubcaption\n";
if (!subcaptionText.empty())
os << "\tsubcaptionText \"" << subcaptionText << '\"' << '\n';
- if (noUnzip)
- os << "\tnoUnzip\n";
- os << "\tsize_kind " << getSizeKindStr(size_kind) << '\n';
- if (!width.zero())
- os << "\twidth " << width.asString() << '\n';
- if (!height.zero())
- os << "\theight " << height.asString() << '\n';
- if (scale != 0)
- os << "\tscale " << scale << '\n';
- if (keepAspectRatio)
- os << "\tkeepAspectRatio\n";
- if (rotate)
- os << "\trotate\n";
- if (rotateAngle != 0.0)
- os << "\trotateAngle " << rotateAngle << '\n';
- if (!rotateOrigin.empty())
- os << "\trotateOrigin " << rotateOrigin << '\n';
if (!special.empty())
os << "\tspecial " << special << '\n';
- // the values for the view in lyx
- os << "\tlyxsize_kind " << getSizeKindStr(lyxsize_kind) << '\n';
- if (!lyxwidth.zero()) // the lyx-viewsize
- os << "\tlyxwidth " << lyxwidth.asString() << '\n';
- if (!lyxheight.zero())
- os << "\tlyxheight " << lyxheight.asString();
- if (keepLyXAspectRatio)
- os << "\tkeepLyXAspectRatio\n";
- if (lyxscale != 0)
- os << "\tlyxscale " << lyxscale << '\n';
}
if (token == "filename") {
lex.eatLine();
filename = lex.getString();
- } else if (token == "BoundingBox") {
- for (int i=0; i<4 ;i++) {
- lex.next();
- bb += (lex.getString()+" ");
- }
- } else if (token == "clip") {
- clip = true;
- } else if (token == "draft") {
- draft = true;
+ } else if (token == "lyxscale") {
+ lex.next();
+ lyxscale = lex.getInteger();
} else if (token == "display") {
lex.next();
string const type = lex.getString();
display = displayTranslator.find(type);
- } else if (token == "subcaption") {
- subcaption = true;
- } else if (token == "subcaptionText") {
- lex.next();
- subcaptionText = lex.getString();
- } else if (token == "noUnzip") {
- noUnzip = true;
- } else if (token == "size_kind") {
- lex.next();
- size_kind = getSizeKind(lex.getString());
- // compatibility-stuff 1.20->1.3.0
- } else if (token == "size_type") {
+ } else if (token == "scale") {
lex.next();
- size_kind = getSizeKind(lex.getInteger());
+ scale = lex.getInteger();
} else if (token == "width") {
lex.next();
width = LyXLength(lex.getString());
+ scale = 0;
} else if (token == "height") {
lex.next();
height = LyXLength(lex.getString());
} else if (token == "keepAspectRatio") {
keepAspectRatio = true;
- } else if (token == "scale") {
- lex.next();
- scale = lex.getInteger();
- } else if (token == "rotate") {
- rotate = true;
+ } else if (token == "draft") {
+ draft = true;
+ } else if (token == "noUnzip") {
+ noUnzip = true;
+ } else if (token == "BoundingBox") {
+ for (int i=0; i<4 ;i++) {
+ lex.next();
+ bb += (lex.getString()+" ");
+ }
+ } else if (token == "clip") {
+ clip = true;
} else if (token == "rotateAngle") {
lex.next();
rotateAngle = lex.getFloat();
} else if (token == "rotateOrigin") {
lex.next();
rotateOrigin=lex.getString();
- } else if (token == "lyxsize_kind") {
- lex.next();
- lyxsize_kind = getSizeKind(lex.getString());
- // compatibility-stuff 1.20->1.3.0
- } else if (token == "lyxsize_type") {
- lex.next();
- lyxsize_kind = getSizeKind(lex.getInteger());
- } else if (token == "lyxwidth") {
- lex.next();
- lyxwidth = LyXLength(lex.getString());
- } else if (token == "lyxheight") {
- lex.next();
- lyxheight = LyXLength(lex.getString());
- } else if (token == "keepLyXAspectRatio") {
- keepLyXAspectRatio = true;
- } else if (token == "lyxscale") {
+ } else if (token == "subcaption") {
+ subcaption = true;
+ } else if (token == "subcaptionText") {
lex.next();
- lyxscale = lex.getInteger();
+ subcaptionText = lex.getString();
} else if (token == "special") {
lex.eatLine();
special = lex.getString();
- } else { // If it's none of the above, its not ours.
+
+ // catch and ignore following two old-format tokens and their arguments.
+ // e.g. "size_kind scale" clashes with the setting of the "scale" keyword.
+ } else if (token == "size_kind" || token == "lyxsize_kind") {
+ lex.next();
+ lex.getString();
+ } else { // If it's none of the above, it's not ours.
return false;
}
return true;
grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const
{
grfx::Params pars;
- pars.width = 0;
- pars.height = 0;
- pars.scale = 0;
- pars.keepLyXAspectRatio = false;
- pars.angle = 0;
pars.filename = filename;
+ pars.scale = lyxscale;
+ pars.angle = rotateAngle;
- if (!filepath.empty()) {
+ if (!filepath.empty())
pars.filename = MakeAbsPath(pars.filename, filepath);
- }
if (clip) {
pars.bb = bb;
string const tmp = readBB_from_PSFile(filename);
lyxerr[Debug::GRAPHICS] << "BB_from_File: " << tmp << std::endl;
if (!tmp.empty()) {
- int const bb_orig_xl = strToInt(token(tmp, ' ', 0));
- int const bb_orig_yb = strToInt(token(tmp, ' ', 1));
+ unsigned int const bb_orig_xl = strToInt(token(tmp, ' ', 0));
+ unsigned int const bb_orig_yb = strToInt(token(tmp, ' ', 1));
- pars.bb.xl -= bb_orig_xl;
- pars.bb.xr -= bb_orig_xl;
- pars.bb.yb -= bb_orig_yb;
- pars.bb.yt -= bb_orig_yb;
+ // new pars.bb values must be >= zero
+ if (pars.bb.xl > bb_orig_xl)
+ pars.bb.xl -= bb_orig_xl;
+ else
+ pars.bb.xl = 0;
+
+ if (pars.bb.xr > bb_orig_xl)
+ pars.bb.xr -= bb_orig_xl;
+ else
+ pars.bb.xr = 0;
+
+ if (pars.bb.yb > bb_orig_yb)
+ pars.bb.yb -= bb_orig_yb;
+ else
+ pars.bb.yb = 0;
+
+ if (pars.bb.yt > bb_orig_yb)
+ pars.bb.yt -= bb_orig_yb;
+ else
+ pars.bb.yt = 0;
}
- pars.bb.xl = std::max(0, pars.bb.xl);
- pars.bb.xr = std::max(0, pars.bb.xr);
- pars.bb.yb = std::max(0, pars.bb.yb);
- pars.bb.yt = std::max(0, pars.bb.yt);
-
// Paranoia check.
int const width = pars.bb.xr - pars.bb.xl;
int const height = pars.bb.yt - pars.bb.yb;
}
}
- if (rotate)
- pars.angle = int(rotateAngle);
-
- switch (display) {
- case InsetGraphicsParams::NONE:
- pars.display = grfx::NoDisplay;
- break;
-
- case InsetGraphicsParams::MONOCHROME:
- pars.display = grfx::MonochromeDisplay;
- break;
-
- case InsetGraphicsParams::GRAYSCALE:
- pars.display = grfx::GrayscaleDisplay;
-
- case InsetGraphicsParams::COLOR:
- pars.display = grfx::ColorDisplay;
- break;
-
- default: {
- if (lyxrc.display_graphics == "mono")
- pars.display = grfx::MonochromeDisplay;
- else if (lyxrc.display_graphics == "gray")
- pars.display = grfx::GrayscaleDisplay;
- else if (lyxrc.display_graphics == "color")
- pars.display = grfx::ColorDisplay;
- else
- pars.display = grfx::NoDisplay;
- }
- }
+ string mode;
+ if (display != grfx::DefaultDisplay)
+ mode = displayTranslator.find(display);
+ else
+ mode = displayTranslator.find(lyxrc.display_graphics);
+ pars.display = displayTranslator.find(mode);
// Override the above if we're not using a gui
if (!lyxrc.use_gui) {
pars.display = grfx::NoDisplay;
}
- if (lyxsize_kind == InsetGraphicsParams::SCALE) {
- pars.scale = lyxscale;
-
- } else if (lyxsize_kind == InsetGraphicsParams::WH) {
- pars.width = lyxwidth.inBP();
- pars.height = lyxheight.inBP();
- pars.keepLyXAspectRatio = keepLyXAspectRatio;
- }
-
return pars;
}
#pragma interface
#endif
+#include "graphics/GraphicsTypes.h"
#include "LString.h"
#include "lyxlength.h"
/// This struct holds all the parameters needed by insetGraphics.
struct InsetGraphicsParams
{
- /// How do we display the image?
- enum DisplayType {
- DEFAULT, // whatever is in lyxrc.display_graphics
- COLOR, // full color range
- GRAYSCALE, // 256 shades of gray
- MONOCHROME, // In black and white.
- NONE // only keep a frame in place.
- };
- ///
- enum sizeKind { // for latex and/or lyx
- DEFAULT_SIZE, // like none
- SCALE, // percentage value
- WH // width/height values
- };
/// Image filename.
string filename;
- /// Do we have a subcaption?
- bool subcaption;
- /// The text of the subcaption.
- string subcaptionText;
- /// Do we rotate?
- bool rotate;
- /// Origin point of rotation
- string rotateOrigin;
- /// Rotation angle.
- float rotateAngle;
- /// clip image
- bool clip;
+ /// Scaling the Screen inside Lyx
+ unsigned int lyxscale;
+ /// How to display the image inside LyX
+ grfx::DisplayType display;
+ /// Scaling for output (LaTeX)
+ unsigned int scale;
+ /// sizes for output (LaTeX)
+ LyXLength width;
+ ///
+ LyXLength height;
+ /// Keep the ratio between height and width when resizing.
+ bool keepAspectRatio;
/// draft mode
bool draft;
/// what to do with zipped files
bool noUnzip;
+
/// The bounding box with "xLB yLB yRT yRT ", divided by a space!
string bb;
- /// Type of rescaling
- sizeKind size_kind;
- /// three possible values for rescaling (latex)
- LyXLength width;
- ///
- LyXLength height;
- ///
- int scale;
- /// Keep the ratio between height and width when resizing.
- bool keepAspectRatio;
+ /// clip image
+ bool clip;
+
+ /// Rotation angle.
+ float rotateAngle;
+ /// Origin point of rotation
+ string rotateOrigin;
+ /// Do we have a subcaption?
+ bool subcaption;
+ /// The text of the subcaption.
+ string subcaptionText;
/// any userdefined special command
string special;
- /// How to display the image inside lyx
- DisplayType display;
- /// the size for the view inside lyx
- LyXLength lyxwidth;
- /// Typ of the LyXView, same as for latex
- sizeKind lyxsize_kind;
- ///
- LyXLength lyxheight;
- /// Keep the ratio between lyxheight and lyxwidth when resizing.
- bool keepLyXAspectRatio;
- /// Typ of rescaling the Screen inside lyx
- int lyxscale;
+
///
InsetGraphicsParams();
///
InsetMinipage::InsetMinipage(BufferParams const & bp)
: InsetCollapsable(bp), pos_(center),
- inner_pos_(inner_center), width_(100, LyXLength::PW)
+ inner_pos_(inner_center), width_(100, LyXLength::PCW)
{
setLabel(_("minipage"));
LyXFont font(LyXFont::ALL_SANE);
int count = 0;
bool env = false;
- LyXFont f = *this; // why do you need this?
- f.reduce(base); // why isn't this just "reduce(base);" (Lgb)
- // Because this function is const. Everything breaks if this
- // method changes the font it represents. There is no speed penalty
- // by using the temporary. (Asger)
-
+ // reduce the current font to changes against the base
+ // font (of the layout). We use a temporary for this to
+ // avoid changing this font instance, as that would break
+ LyXFont f = *this;
+ f.reduce(base);
if (f.family() != INHERIT_FAMILY) {
os << '}';
case LFUN_REDO:
disable = buf->redostack.empty();
break;
+ case LFUN_CUT:
+ case LFUN_COPY:
+ disable = !view()->getLyXText()->selection.set();
+ break;
#ifndef HAVE_LIBAIKSAURUS
case LFUN_THESAURUS_ENTRY:
disable = true;
{
ostringstream buffer;
switch (unit_) {
- case PW:
+ case PTW:
buffer << abs(static_cast<int>(val_/100)) << "."
<< abs(static_cast<int>(val_)%100) << "\\textwidth";
break;
- case PE:
+ case PCW:
buffer << abs(static_cast<int>(val_/100)) << "."
<< abs(static_cast<int>(val_)%100) << "\\columnwidth";
break;
- case PP:
+ case PPW:
buffer << abs(static_cast<int>(val_/100)) << "."
<< abs(static_cast<int>(val_)%100) << "\\paperwidth";
break;
- case PL:
+ case PLW:
buffer << abs(static_cast<int>(val_/100)) << "."
<< abs(static_cast<int>(val_)%100) << "\\linewidth";
break;
- case PH:
+ case PPH:
buffer << abs(static_cast<int>(val_/100)) << "."
<< abs(static_cast<int>(val_)%100) << "\\paperheight";
break;
- case TH:
+ case PTH:
buffer << abs(static_cast<int>(val_/100)) << "."
<< abs(static_cast<int>(val_)%100) << "\\textheight";
break;
// math mode
result = zoom * val_ * default_height;
break;
- case LyXLength::PW: // Always % of workarea
- case LyXLength::PE:
- case LyXLength::PP:
- case LyXLength::PL:
+ case LyXLength::PCW: // Always % of workarea
+ case LyXLength::PTW:
+ case LyXLength::PPW:
+ case LyXLength::PLW:
result = val_ * default_width / 100;
break;
- case LyXLength::PH:
- case LyXLength::TH:
+ case LyXLength::PTH:
+ case LyXLength::PPH:
result = val_ * default_height / 100;
break;
case LyXLength::UNIT_NONE:
EX, ///< Height of a small "x" for the current font.
EM, ///< Width of capital "M" in current font.
MU, ///< Math unit (18mu = 1em) for positioning in math mode
- PW, ///< Percent of columnwidth
- PE, ///< Percent of textwidth
- PP, ///< Percent of pagewidth
- PL, ///< Percent of linewidth
- TH, ///< Percent of textheight // Herbert 2002-05-16
- PH, ///< Percent of paperheight // Herbert 2002-05-16
+ PTW, //< Percent of TextWidth
+ PCW, //< Percent of ColumnWidth
+ PPW, //< Percent of PageWidth
+ PLW, //< Percent of LineWidth
+ PTH, //< Percent of TextHeight // Herbert 2002-05-16
+ PPH, //< Percent of PaperHeight // Herbert 2002-05-16
UNIT_NONE ///< no unit
};
break;
case RC_DISPLAY_GRAPHICS:
- if (lexrc.next())
+ if (lexrc.next()) {
display_graphics = lexrc.getString();
+ // backward compatibility
+ if (display_graphics == "mono") display_graphics = "monochrome";
+ else if (display_graphics == "gray") display_graphics = "grayscale";
+ else if (display_graphics == "no") display_graphics = "none";
+ }
break;
case RC_KBMAP:
case RC_DISPLAY_GRAPHICS:
if (display_graphics != system_lyxrc.display_graphics) {
os << "# Display graphics within LyX\n"
- << "# no|mono|gray|color\n"
+ << "# monochrome|grayscale|color|none\n"
<< "\\display_graphics " << display_graphics
<< "\n";
}
// replace the paragraphs with the undo informations
- Paragraph * tmppar3 = undo.par;
+ Paragraph * undopar = undo.par;
undo.par = 0; /* otherwise the undo destructor would
delete the paragraph */
// paragraph if there is any. This is not needed if we don't have
// a paragraph before because then in is automatically done in the
// function which assigns the first paragraph to an InsetText. (Jug)
- Paragraph * tmppar4 = tmppar3;
- if (tmppar4) {
+ Paragraph * lastundopar = undopar;
+ if (lastundopar) {
Inset * in = 0;
if (before)
in = before->inInset();
else if (undo.number_of_inset_id >= 0)
in = bv->buffer()->getInsetFromID(undo.number_of_inset_id);
- tmppar4->setInsetOwner(in);
- while (tmppar4->next()) {
- tmppar4 = tmppar4->next();
- tmppar4->setInsetOwner(in);
+ lastundopar->setInsetOwner(in);
+ while (lastundopar->next()) {
+ lastundopar = lastundopar->next();
+ lastundopar->setInsetOwner(in);
}
}
deletepar = before->next();
else
deletepar = firstUndoParagraph(bv, undo.number_of_inset_id);
- tmppar2 = tmppar3;
+ tmppar2 = undopar;
while (deletepar && deletepar != behind) {
deletelist.push_back(deletepar);
tmppar = deletepar;
}
// put the new stuff in the list if there is one
- if (tmppar3) {
+ if (undopar) {
if (before)
- before->next(tmppar3);
+ before->next(undopar);
else
bv->text->ownerParagraph(firstUndoParagraph(bv, undo.number_of_inset_id)->id(),
- tmppar3);
+ undopar);
- tmppar3->previous(before);
+ undopar->previous(before);
} else {
// We enter here on DELETE undo operations where we have to
// substitue the second paragraph with the first if the removed
if (!before && behind) {
bv->text->ownerParagraph(firstUndoParagraph(bv, undo.number_of_inset_id)->id(),
behind);
- tmppar3 = behind;
+ undopar = behind;
}
}
- if (tmppar4) {
- tmppar4->next(behind);
+
+ // thread the end of the undo onto the par in front if any
+ if (lastundopar) {
+ lastundopar->next(behind);
if (behind)
- behind->previous(tmppar4);
+ behind->previous(lastundopar);
}
tmppar = bv->buffer()->getParFromID(undo.number_of_cursor_par);
UpdatableInset* it = 0;
- if (tmppar3)
- it = static_cast<UpdatableInset*>(tmppar3->inInset());
+ if (undopar)
+ it = static_cast<UpdatableInset*>(undopar->inInset());
if (it) {
it->getLyXText(bv)->redoParagraphs(bv,
it->getLyXText(bv)->cursor,