mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
latest graphics jumbo patch from herbert
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4741 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
cf392753f3
commit
af9352a2e7
@ -1,3 +1,8 @@
|
|||||||
|
2002-07-22 Herbert Voss <voss@lyx.org>
|
||||||
|
|
||||||
|
* scripts/convertDefault.sh: defines a converter which is used
|
||||||
|
when no userdefined was found
|
||||||
|
|
||||||
2002-07-20 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
2002-07-20 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||||
|
|
||||||
* ui/default.ui: cleanup after change of Menu syntax. the
|
* ui/default.ui: cleanup after change of Menu syntax. the
|
||||||
|
10
lib/scripts/convertDefault.sh
Normal file
10
lib/scripts/convertDefault.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# this is the default converter if no one other was
|
||||||
|
# defined by the user in edit->preferences->converter
|
||||||
|
#
|
||||||
|
# the user can also redefine this default converter
|
||||||
|
# with an own shell script in ~/.lyx/scripts
|
||||||
|
#
|
||||||
|
# converts an image from $1 to $2 format
|
||||||
|
convert -depth 8 $1 $2
|
||||||
|
exit 0
|
@ -1,3 +1,8 @@
|
|||||||
|
2002-07-22 Herbert Voss <voss@lyx.org>
|
||||||
|
|
||||||
|
* lengthcommon.C:
|
||||||
|
* lyxlength.[Ch]: add support for the vertical lengths
|
||||||
|
|
||||||
2002-07-21 John Levon <moz@compsoc.man.ac.uk>
|
2002-07-21 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
* toc.[Ch]: std:: fixes
|
* toc.[Ch]: std:: fixes
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2002-07-22 Herbert Voss <voss@lyx.org>
|
||||||
|
|
||||||
|
* ControlGraphics.C: small changes
|
||||||
|
|
||||||
2002-07-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
2002-07-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||||
|
|
||||||
* ControlToc.C: remove getType
|
* ControlToc.C: remove getType
|
||||||
|
@ -68,6 +68,7 @@ void ControlGraphics::applyParamsToInset()
|
|||||||
// Set the parameters in the inset, it also returns true if the new
|
// Set the parameters in the inset, it also returns true if the new
|
||||||
// parameters are different from what was in the inset already.
|
// parameters are different from what was in the inset already.
|
||||||
bool changed = inset()->setParams(params(), lv_.buffer()->filePath());
|
bool changed = inset()->setParams(params(), lv_.buffer()->filePath());
|
||||||
|
|
||||||
// Tell LyX we've got a change, and mark the document dirty,
|
// Tell LyX we've got a change, and mark the document dirty,
|
||||||
// if it changed.
|
// if it changed.
|
||||||
lv_.view()->updateInset(inset(), changed);
|
lv_.view()->updateInset(inset(), changed);
|
||||||
@ -105,10 +106,11 @@ string const ControlGraphics::readBB(string const & file)
|
|||||||
{
|
{
|
||||||
string const abs_file = MakeAbsPath(file, lv_.buffer()->filePath());
|
string const abs_file = MakeAbsPath(file, lv_.buffer()->filePath());
|
||||||
|
|
||||||
string const from = getExtFromContents(abs_file);
|
// try to get it from the file, if possible. Zipped files are
|
||||||
// Check if we have a Postscript file, then it's easy
|
// unzipped in the readBB_from_PSFile-Function
|
||||||
if (contains(from, "ps"))
|
string const bb = readBB_from_PSFile(abs_file);
|
||||||
return readBB_from_PSFile(abs_file);
|
if (!bb.empty())
|
||||||
|
return bb;
|
||||||
|
|
||||||
// we don't, so ask the Graphics Cache if it has loaded the file
|
// we don't, so ask the Graphics Cache if it has loaded the file
|
||||||
int width = 0;
|
int width = 0;
|
||||||
@ -144,6 +146,7 @@ namespace {
|
|||||||
// correspond to the LaTeX identifiers shown in the comments at the
|
// correspond to the LaTeX identifiers shown in the comments at the
|
||||||
// end of each line.
|
// end of each line.
|
||||||
char const * const rorigin_lyx_strs[] = {
|
char const * const rorigin_lyx_strs[] = {
|
||||||
|
// the LaTeX default is leftBaseline
|
||||||
"center", // c
|
"center", // c
|
||||||
"leftTop", "leftBottom", "leftBaseline", // lt lb lB
|
"leftTop", "leftBottom", "leftBaseline", // lt lb lB
|
||||||
"centerTop", "centerBottom", "centerBaseline", // ct cb cB
|
"centerTop", "centerBottom", "centerBaseline", // ct cb cB
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2002-07-22 Herbert Voss <voss@lyx.org>
|
||||||
|
|
||||||
|
* FormGraphics.C: add tooltips, changesize_type to size_kind.
|
||||||
|
some rearrangements to the code
|
||||||
|
|
||||||
2002-07-21 John Levon <moz@compsoc.man.ac.uk>
|
2002-07-21 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
* FormToc.C: std:: fix
|
* FormToc.C: std:: fix
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "FormGraphics.h"
|
#include "FormGraphics.h"
|
||||||
#include "forms/form_graphics.h"
|
#include "forms/form_graphics.h"
|
||||||
#include "Alert.h"
|
#include "Alert.h"
|
||||||
|
#include "Tooltips.h"
|
||||||
|
|
||||||
#include "xforms_helpers.h"
|
#include "xforms_helpers.h"
|
||||||
#include "helper_funcs.h"
|
#include "helper_funcs.h"
|
||||||
@ -113,6 +114,33 @@ void FormGraphics::build()
|
|||||||
bc().addReadOnly(file_->check_draft);
|
bc().addReadOnly(file_->check_draft);
|
||||||
bc().addReadOnly(file_->check_nounzip);
|
bc().addReadOnly(file_->check_nounzip);
|
||||||
|
|
||||||
|
// set up the tooltips for the filesection
|
||||||
|
string str = _("The file you want to insert.");
|
||||||
|
tooltips().init(file_->input_filename, str);
|
||||||
|
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 = _("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");
|
||||||
|
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
|
// the lyxview section
|
||||||
lyxview_.reset(build_graphics_lyxview(this));
|
lyxview_.reset(build_graphics_lyxview(this));
|
||||||
|
|
||||||
@ -134,6 +162,45 @@ void FormGraphics::build()
|
|||||||
bc().addReadOnly(lyxview_->radio_nodisplay);
|
bc().addReadOnly(lyxview_->radio_nodisplay);
|
||||||
bc().addReadOnly(lyxview_->check_lyxaspectratio);
|
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
|
// the size section
|
||||||
size_.reset(build_graphics_size(this));
|
size_.reset(build_graphics_size(this));
|
||||||
|
|
||||||
@ -159,6 +226,35 @@ void FormGraphics::build()
|
|||||||
bc().addReadOnly(size_->radio_scale);
|
bc().addReadOnly(size_->radio_scale);
|
||||||
bc().addReadOnly(size_->check_aspectratio);
|
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
|
// the bounding box selection
|
||||||
bbox_.reset(build_graphics_bbox(this));
|
bbox_.reset(build_graphics_bbox(this));
|
||||||
fl_set_input_return (bbox_->input_bb_x0, FL_RETURN_CHANGED);
|
fl_set_input_return (bbox_->input_bb_x0, FL_RETURN_CHANGED);
|
||||||
@ -181,18 +277,45 @@ void FormGraphics::build()
|
|||||||
bc().addReadOnly(bbox_->button_getBB);
|
bc().addReadOnly(bbox_->button_getBB);
|
||||||
bc().addReadOnly(bbox_->check_clip);
|
bc().addReadOnly(bbox_->check_clip);
|
||||||
|
|
||||||
|
// set up the tooltips for the bounding-box-section
|
||||||
|
str = _("The lower left x-value of the bounding box");
|
||||||
|
tooltips().init(bbox_->input_bb_x0, str);
|
||||||
|
str = _("The lower left y-value of the bounding box");
|
||||||
|
tooltips().init(bbox_->input_bb_y0, str);
|
||||||
|
str = _("The upper right x-value of the bounding box");
|
||||||
|
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");
|
||||||
|
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.");
|
||||||
|
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
|
// the rotate section
|
||||||
special_.reset(build_graphics_special(this));
|
special_.reset(build_graphics_special(this));
|
||||||
|
|
||||||
fl_set_input_return (special_->input_special, FL_RETURN_CHANGED);
|
fl_set_input_return (special_->input_special, FL_RETURN_CHANGED);
|
||||||
setPrehandler(special_->input_special);
|
setPrehandler(special_->input_special);
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
// add the different tabfolders
|
// add the different tabfolders
|
||||||
fl_addto_tabfolder(dialog_->tabfolder, _("File"), file_->form);
|
fl_addto_tabfolder(dialog_->tabfolder, _("File"), file_->form);
|
||||||
fl_addto_tabfolder(dialog_->tabfolder, _("LyX View"), lyxview_->form);
|
fl_addto_tabfolder(dialog_->tabfolder, _("LyX View"), lyxview_->form);
|
||||||
fl_addto_tabfolder(dialog_->tabfolder, _("LaTeX Size"), size_->form);
|
fl_addto_tabfolder(dialog_->tabfolder, _("LaTeX Size"), size_->form);
|
||||||
fl_addto_tabfolder(dialog_->tabfolder, _("Bounding Box"), bbox_->form);
|
fl_addto_tabfolder(dialog_->tabfolder, _("Bounding Box"), bbox_->form);
|
||||||
fl_addto_tabfolder(dialog_->tabfolder, _("Extras"), special_->form);
|
fl_addto_tabfolder(dialog_->tabfolder, _("Extras"), special_->form);
|
||||||
|
|
||||||
// set the right default unit
|
// set the right default unit
|
||||||
if (lyxrc.default_papersize < 3)
|
if (lyxrc.default_papersize < 3)
|
||||||
defaultUnit = "in";
|
defaultUnit = "in";
|
||||||
@ -240,11 +363,11 @@ void FormGraphics::apply()
|
|||||||
igp.display = InsetGraphicsParams::NONE;
|
igp.display = InsetGraphicsParams::NONE;
|
||||||
|
|
||||||
if (fl_get_button(lyxview_->radio_lyxasis))
|
if (fl_get_button(lyxview_->radio_lyxasis))
|
||||||
igp.lyxsize_type = InsetGraphicsParams::DEFAULT_SIZE;
|
igp.lyxsize_kind = InsetGraphicsParams::DEFAULT_SIZE;
|
||||||
else if (fl_get_button(lyxview_->radio_lyxwh))
|
else if (fl_get_button(lyxview_->radio_lyxwh))
|
||||||
igp.lyxsize_type = InsetGraphicsParams::WH;
|
igp.lyxsize_kind = InsetGraphicsParams::WH;
|
||||||
else
|
else
|
||||||
igp.lyxsize_type = InsetGraphicsParams::SCALE;
|
igp.lyxsize_kind = InsetGraphicsParams::SCALE;
|
||||||
|
|
||||||
igp.lyxwidth = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
|
igp.lyxwidth = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
|
||||||
lyxview_->choice_lyxwidth);
|
lyxview_->choice_lyxwidth);
|
||||||
@ -257,11 +380,11 @@ void FormGraphics::apply()
|
|||||||
|
|
||||||
// the size section
|
// the size section
|
||||||
if (fl_get_button(size_->radio_asis))
|
if (fl_get_button(size_->radio_asis))
|
||||||
igp.size_type = InsetGraphicsParams::DEFAULT_SIZE;
|
igp.size_kind = InsetGraphicsParams::DEFAULT_SIZE;
|
||||||
else if (fl_get_button(size_->radio_wh))
|
else if (fl_get_button(size_->radio_wh))
|
||||||
igp.size_type = InsetGraphicsParams::WH;
|
igp.size_kind = InsetGraphicsParams::WH;
|
||||||
else
|
else
|
||||||
igp.size_type = InsetGraphicsParams::SCALE;
|
igp.size_kind = InsetGraphicsParams::SCALE;
|
||||||
|
|
||||||
igp.width = getLyXLengthFromWidgets(size_->input_width,
|
igp.width = getLyXLengthFromWidgets(size_->input_width,
|
||||||
size_->choice_width);
|
size_->choice_width);
|
||||||
@ -356,7 +479,7 @@ void FormGraphics::update() {
|
|||||||
updateWidgetsFromLength(lyxview_->input_lyxheight,
|
updateWidgetsFromLength(lyxview_->input_lyxheight,
|
||||||
lyxview_->choice_lyxheight, igp.lyxheight, defaultUnit);
|
lyxview_->choice_lyxheight, igp.lyxheight, defaultUnit);
|
||||||
fl_set_input(lyxview_->input_lyxscale, tostr(igp.lyxscale).c_str());
|
fl_set_input(lyxview_->input_lyxscale, tostr(igp.lyxscale).c_str());
|
||||||
switch (igp.lyxsize_type) {
|
switch (igp.lyxsize_kind) {
|
||||||
case InsetGraphicsParams::DEFAULT_SIZE: {
|
case InsetGraphicsParams::DEFAULT_SIZE: {
|
||||||
fl_set_button(lyxview_->radio_lyxasis,1);
|
fl_set_button(lyxview_->radio_lyxasis,1);
|
||||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
setEnabled(lyxview_->input_lyxwidth, 0);
|
||||||
@ -367,6 +490,15 @@ void FormGraphics::update() {
|
|||||||
setEnabled(lyxview_->input_lyxscale, 0);
|
setEnabled(lyxview_->input_lyxscale, 0);
|
||||||
break;
|
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: {
|
case InsetGraphicsParams::WH: {
|
||||||
fl_set_button(lyxview_->radio_lyxwh, 1);
|
fl_set_button(lyxview_->radio_lyxwh, 1);
|
||||||
setEnabled(lyxview_->input_lyxwidth, 1);
|
setEnabled(lyxview_->input_lyxwidth, 1);
|
||||||
@ -377,17 +509,8 @@ void FormGraphics::update() {
|
|||||||
setEnabled(lyxview_->input_lyxscale, 0);
|
setEnabled(lyxview_->input_lyxscale, 0);
|
||||||
break;
|
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_->check_lyxaspectratio, 0);
|
|
||||||
setEnabled(lyxview_->input_lyxscale, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
fl_set_button(lyxview_->check_lyxaspectratio, igp.keepLyXAspectRatio);
|
||||||
|
|
||||||
fl_set_button(lyxview_->check_lyxaspectratio, igp.keepLyXAspectRatio);
|
fl_set_button(lyxview_->check_lyxaspectratio, igp.keepLyXAspectRatio);
|
||||||
|
|
||||||
@ -398,7 +521,9 @@ void FormGraphics::update() {
|
|||||||
updateWidgetsFromLength(size_->input_height,
|
updateWidgetsFromLength(size_->input_height,
|
||||||
size_->choice_height, igp.height, defaultUnit);
|
size_->choice_height, igp.height, defaultUnit);
|
||||||
fl_set_input(size_->input_scale, tostr(igp.scale).c_str());
|
fl_set_input(size_->input_scale, tostr(igp.scale).c_str());
|
||||||
switch (igp.size_type) {
|
lyxerr[Debug::GRAPHICS] << "FormGraphics::update: igp.size_kind = "
|
||||||
|
<< igp.size_kind << endl;
|
||||||
|
switch (igp.size_kind) {
|
||||||
case InsetGraphicsParams::DEFAULT_SIZE: {
|
case InsetGraphicsParams::DEFAULT_SIZE: {
|
||||||
fl_set_button(size_->radio_asis,1);
|
fl_set_button(size_->radio_asis,1);
|
||||||
setEnabled(size_->input_width, 0);
|
setEnabled(size_->input_width, 0);
|
||||||
@ -409,16 +534,6 @@ void FormGraphics::update() {
|
|||||||
setEnabled(size_->input_scale, 0);
|
setEnabled(size_->input_scale, 0);
|
||||||
break;
|
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;
|
|
||||||
}
|
|
||||||
case InsetGraphicsParams::SCALE: {
|
case InsetGraphicsParams::SCALE: {
|
||||||
fl_set_button(size_->radio_scale, 1);
|
fl_set_button(size_->radio_scale, 1);
|
||||||
setEnabled(size_->input_width, 0);
|
setEnabled(size_->input_width, 0);
|
||||||
@ -429,6 +544,16 @@ void FormGraphics::update() {
|
|||||||
setEnabled(size_->input_scale, 1);
|
setEnabled(size_->input_scale, 1);
|
||||||
break;
|
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);
|
fl_set_button(size_->check_aspectratio, igp.keepAspectRatio);
|
||||||
|
|
||||||
@ -539,13 +664,6 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
setEnabled(lyxview_->choice_lyxheight, 0);
|
||||||
setEnabled(lyxview_->check_lyxaspectratio, 0);
|
setEnabled(lyxview_->check_lyxaspectratio, 0);
|
||||||
setEnabled(lyxview_->input_lyxscale, 0);
|
setEnabled(lyxview_->input_lyxscale, 0);
|
||||||
} 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_->radio_lyxscale) {
|
} else if (ob == lyxview_->radio_lyxscale) {
|
||||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
setEnabled(lyxview_->input_lyxwidth, 0);
|
||||||
setEnabled(lyxview_->choice_lyxwidth, 0);
|
setEnabled(lyxview_->choice_lyxwidth, 0);
|
||||||
@ -553,6 +671,13 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
setEnabled(lyxview_->choice_lyxheight, 0);
|
||||||
setEnabled(lyxview_->check_lyxaspectratio, 0);
|
setEnabled(lyxview_->check_lyxaspectratio, 0);
|
||||||
setEnabled(lyxview_->input_lyxscale, 1);
|
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) {
|
} else if (ob == lyxview_->button_latex_values) {
|
||||||
if (contains(fl_get_choice_text(size_->choice_width),'%') ||
|
if (contains(fl_get_choice_text(size_->choice_width),'%') ||
|
||||||
contains(fl_get_choice_text(size_->choice_height),'%'))
|
contains(fl_get_choice_text(size_->choice_height),'%'))
|
||||||
@ -582,14 +707,6 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
setEnabled(lyxview_->choice_lyxheight, 0);
|
||||||
setEnabled(lyxview_->check_lyxaspectratio, 0);
|
setEnabled(lyxview_->check_lyxaspectratio, 0);
|
||||||
setEnabled(lyxview_->input_lyxscale, 0);
|
setEnabled(lyxview_->input_lyxscale, 0);
|
||||||
} 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);
|
|
||||||
} else if (fl_get_button (size_->radio_scale) ==1) {
|
} else if (fl_get_button (size_->radio_scale) ==1) {
|
||||||
fl_set_button (lyxview_->radio_lyxscale, 1);
|
fl_set_button (lyxview_->radio_lyxscale, 1);
|
||||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
setEnabled(lyxview_->input_lyxwidth, 0);
|
||||||
@ -598,6 +715,15 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
setEnabled(lyxview_->choice_lyxheight, 0);
|
||||||
setEnabled(lyxview_->check_lyxaspectratio, 0);
|
setEnabled(lyxview_->check_lyxaspectratio, 0);
|
||||||
setEnabled(lyxview_->input_lyxscale, 1);
|
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_set_button(lyxview_->check_lyxaspectratio,
|
||||||
@ -638,13 +764,6 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
setEnabled(size_->choice_height, 0);
|
setEnabled(size_->choice_height, 0);
|
||||||
setEnabled(size_->check_aspectratio, 0);
|
setEnabled(size_->check_aspectratio, 0);
|
||||||
setEnabled(size_->input_scale, 0);
|
setEnabled(size_->input_scale, 0);
|
||||||
} 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_->radio_scale) {
|
} else if (ob == size_->radio_scale) {
|
||||||
setEnabled(size_->input_width, 0);
|
setEnabled(size_->input_width, 0);
|
||||||
setEnabled(size_->choice_width, 0);
|
setEnabled(size_->choice_width, 0);
|
||||||
@ -652,6 +771,13 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
setEnabled(size_->choice_height, 0);
|
setEnabled(size_->choice_height, 0);
|
||||||
setEnabled(size_->check_aspectratio, 0);
|
setEnabled(size_->check_aspectratio, 0);
|
||||||
setEnabled(size_->input_scale, 1);
|
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) {
|
} else if (ob == size_->button_lyx_values) {
|
||||||
LyXLength dummy = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
|
LyXLength dummy = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
|
||||||
lyxview_->choice_lyxwidth);
|
lyxview_->choice_lyxwidth);
|
||||||
@ -673,14 +799,6 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
setEnabled(size_->choice_height, 0);
|
setEnabled(size_->choice_height, 0);
|
||||||
setEnabled(size_->check_aspectratio, 0);
|
setEnabled(size_->check_aspectratio, 0);
|
||||||
setEnabled(size_->input_scale, 0);
|
setEnabled(size_->input_scale, 0);
|
||||||
} 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);
|
|
||||||
} else if (fl_get_button (lyxview_->radio_lyxscale) ==1) {
|
} else if (fl_get_button (lyxview_->radio_lyxscale) ==1) {
|
||||||
fl_set_button (size_->radio_scale, 1);
|
fl_set_button (size_->radio_scale, 1);
|
||||||
setEnabled(size_->input_width, 0);
|
setEnabled(size_->input_width, 0);
|
||||||
@ -689,6 +807,14 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
setEnabled(size_->choice_height, 0);
|
setEnabled(size_->choice_height, 0);
|
||||||
setEnabled(size_->check_aspectratio, 0);
|
setEnabled(size_->check_aspectratio, 0);
|
||||||
setEnabled(size_->input_scale, 1);
|
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_set_button(size_->check_aspectratio,
|
||||||
fl_get_button(lyxview_->check_lyxaspectratio));
|
fl_get_button(lyxview_->check_lyxaspectratio));
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2002-07-22 Herbert Voss <voss@lyx.org>
|
||||||
|
|
||||||
|
* GraphicsConverter.C: get the "default converter" run again
|
||||||
|
|
||||||
2002-07-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
2002-07-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||||
|
|
||||||
* PreviewLoader.C: use BufferParams::getLyXTextClass
|
* PreviewLoader.C: use BufferParams::getLyXTextClass
|
||||||
|
@ -137,38 +137,53 @@ Converter::Impl::Impl(string const & from_file, string const & to_file_base,
|
|||||||
bool const success = build_script(from_file, to_file_base,
|
bool const success = build_script(from_file, to_file_base,
|
||||||
from_format, to_format, script);
|
from_format, to_format, script);
|
||||||
|
|
||||||
if (!success)
|
// The converted image is to be stored in this file
|
||||||
return;
|
to_file_ = ChangeExtension(to_file_base, formats.extension(to_format));
|
||||||
|
|
||||||
lyxerr[Debug::GRAPHICS] << "\tConversion script:"
|
if (!success) {
|
||||||
|
script_file_ = string();
|
||||||
|
if (from_format == "lyxpreview") {
|
||||||
|
script_command_ =
|
||||||
|
LibFileSearch("scripts", "lyxpreview2xpm.sh")
|
||||||
|
+ " " +from_file + " " + to_file_;
|
||||||
|
lyxerr[Debug::GRAPHICS]
|
||||||
|
<< "\tI use lyxpreview2xpm for the conversion\n\t"
|
||||||
|
<< script_command_ << endl;
|
||||||
|
} else {
|
||||||
|
script_command_ =
|
||||||
|
LibFileSearch("scripts", "convertDefault.sh") +
|
||||||
|
' ' + from_format + ':' + from_file + ' ' +
|
||||||
|
to_format + ':' + to_file_;
|
||||||
|
lyxerr[Debug::GRAPHICS]
|
||||||
|
<< "\tNo converter defined! I use convertDefault.sh\n\t"
|
||||||
|
<< script_command_ << endl;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
lyxerr[Debug::GRAPHICS] << "\tConversion script:"
|
||||||
<< "\n--------------------------------------\n"
|
<< "\n--------------------------------------\n"
|
||||||
<< script.str().c_str()
|
<< script.str().c_str()
|
||||||
<< "\n--------------------------------------\n";
|
<< "\n--------------------------------------\n";
|
||||||
|
|
||||||
// Output the script to file.
|
// Output the script to file.
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
script_file_ = OnlyPath(to_file_base) + "lyxconvert" +
|
script_file_ = OnlyPath(to_file_base) + "lyxconvert" +
|
||||||
tostr(counter++) + ".sh";
|
tostr(counter++) + ".sh";
|
||||||
|
|
||||||
std::ofstream fs(script_file_.c_str());
|
std::ofstream fs(script_file_.c_str());
|
||||||
if (!fs.good())
|
if (!fs.good())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fs << script.str().c_str();
|
fs << script.str().c_str();
|
||||||
fs.close();
|
fs.close();
|
||||||
|
|
||||||
// The converted image is to be stored in this file
|
|
||||||
// We do not use ChangeExtension here because this is a
|
|
||||||
// basename, which may nevertheless contain a dot
|
|
||||||
to_file_ = to_file_base + '.' + formats.extension(to_format);
|
|
||||||
|
|
||||||
// The command needed to run the conversion process
|
|
||||||
// We create a dummy command for ease of understanding of the
|
|
||||||
// list of forked processes.
|
|
||||||
// Note that 'sh ' is absolutely essential, or execvp will fail.
|
|
||||||
script_command_ = "sh " + script_file_ + " " +
|
|
||||||
OnlyFilename(from_file) + " " + to_format;
|
|
||||||
|
|
||||||
|
// The command needed to run the conversion process
|
||||||
|
// We create a dummy command for ease of understanding of the
|
||||||
|
// list of forked processes.
|
||||||
|
// Note that 'sh ' is absolutely essential, or execvp will fail.
|
||||||
|
script_command_ = "sh " + script_file_ + " " +
|
||||||
|
OnlyFilename(from_file) + " " + to_format;
|
||||||
|
}
|
||||||
// All is ready to go
|
// All is ready to go
|
||||||
valid_process_ = true;
|
valid_process_ = true;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2002-07-22 Herbert Voss <voss@lyx.org>
|
||||||
|
|
||||||
|
* insetgraphics.C:
|
||||||
|
* insetgraphicsParams.[Ch]: change size_type to size_kind and
|
||||||
|
other small changes
|
||||||
|
|
||||||
2002-07-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
2002-07-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||||
|
|
||||||
* insettext.h: do not include "paragraph.h" and "lyxcursor.h"
|
* insettext.h: do not include "paragraph.h" and "lyxcursor.h"
|
||||||
|
@ -446,8 +446,10 @@ void InsetGraphics::readInsetGraphics(LyXLex & lex)
|
|||||||
// FormatVersion < 1.0 (LyX < 1.2)
|
// FormatVersion < 1.0 (LyX < 1.2)
|
||||||
void InsetGraphics::readFigInset(LyXLex & lex)
|
void InsetGraphics::readFigInset(LyXLex & lex)
|
||||||
{
|
{
|
||||||
std::vector<string> const oldUnits =
|
std::vector<string> const oldUnitsWidth =
|
||||||
getVectorFromString("pt,cm,in,p%,c%");
|
getVectorFromString("pt, cm, in, text%, col%");
|
||||||
|
std::vector<string> const oldUnitsHeight =
|
||||||
|
getVectorFromString("pt, cm, in, theight%");
|
||||||
bool finished = false;
|
bool finished = false;
|
||||||
// set the display default
|
// set the display default
|
||||||
if (lyxrc.display_graphics == "mono")
|
if (lyxrc.display_graphics == "mono")
|
||||||
@ -491,7 +493,7 @@ void InsetGraphics::readFigInset(LyXLex & lex)
|
|||||||
params_.lyxwidth = LyXLength(lex.getString()+"pt");
|
params_.lyxwidth = LyXLength(lex.getString()+"pt");
|
||||||
if (lex.next())
|
if (lex.next())
|
||||||
params_.lyxheight = LyXLength(lex.getString()+"pt");
|
params_.lyxheight = LyXLength(lex.getString()+"pt");
|
||||||
params_.lyxsize_type = InsetGraphicsParams::WH;
|
params_.lyxsize_kind = InsetGraphicsParams::WH;
|
||||||
} else if (token == "flags") {
|
} else if (token == "flags") {
|
||||||
if (lex.next())
|
if (lex.next())
|
||||||
switch (lex.getInteger()) {
|
switch (lex.getInteger()) {
|
||||||
@ -501,6 +503,8 @@ void InsetGraphics::readFigInset(LyXLex & lex)
|
|||||||
break;
|
break;
|
||||||
case 3: params_.display = InsetGraphicsParams::COLOR;
|
case 3: params_.display = InsetGraphicsParams::COLOR;
|
||||||
break;
|
break;
|
||||||
|
case 8: params_.display = InsetGraphicsParams::NONE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else if (token == "subfigure") {
|
} else if (token == "subfigure") {
|
||||||
params_.subcaption = true;
|
params_.subcaption = true;
|
||||||
@ -510,10 +514,15 @@ void InsetGraphics::readFigInset(LyXLex & lex)
|
|||||||
if (lex.next()) {
|
if (lex.next()) {
|
||||||
if (i == 5) {
|
if (i == 5) {
|
||||||
params_.scale = lex.getInteger();
|
params_.scale = lex.getInteger();
|
||||||
params_.size_type = InsetGraphicsParams::SCALE;
|
params_.size_kind = InsetGraphicsParams::SCALE;
|
||||||
} else {
|
} else {
|
||||||
params_.width = LyXLength(lex.getString()+oldUnits[i]);
|
string const value = lex.getString();
|
||||||
params_.size_type = InsetGraphicsParams::WH;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -521,8 +530,13 @@ void InsetGraphics::readFigInset(LyXLex & lex)
|
|||||||
if (lex.next()) {
|
if (lex.next()) {
|
||||||
int i = lex.getInteger();
|
int i = lex.getInteger();
|
||||||
if (lex.next()) {
|
if (lex.next()) {
|
||||||
params_.height = LyXLength(lex.getString()+oldUnits[i]);
|
string const value = lex.getString();
|
||||||
params_.size_type = InsetGraphicsParams::WH;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -541,12 +555,12 @@ string const InsetGraphics::createLatexOptions() const
|
|||||||
options << " draft,\n";
|
options << " draft,\n";
|
||||||
if (params().clip)
|
if (params().clip)
|
||||||
options << " clip,\n";
|
options << " clip,\n";
|
||||||
if (params().size_type == InsetGraphicsParams::WH) {
|
if (params().size_kind == InsetGraphicsParams::WH) {
|
||||||
if (!params().width.zero())
|
if (!params().width.zero())
|
||||||
options << " width=" << params().width.asLatexString() << ",\n";
|
options << " width=" << params().width.asLatexString() << ",\n";
|
||||||
if (!params().height.zero())
|
if (!params().height.zero())
|
||||||
options << " height=" << params().height.asLatexString() << ",\n";
|
options << " height=" << params().height.asLatexString() << ",\n";
|
||||||
} else if (params().size_type == InsetGraphicsParams::SCALE) {
|
} else if (params().size_kind == InsetGraphicsParams::SCALE) {
|
||||||
if (params().scale > 0)
|
if (params().scale > 0)
|
||||||
options << " scale=" << double(params().scale)/100.0 << ",\n";
|
options << " scale=" << double(params().scale)/100.0 << ",\n";
|
||||||
}
|
}
|
||||||
@ -581,7 +595,7 @@ string findTargetFormat(string const & suffix)
|
|||||||
// (Should actually mean, are we using latex or pdflatex).
|
// (Should actually mean, are we using latex or pdflatex).
|
||||||
if (lyxrc.pdf_mode) {
|
if (lyxrc.pdf_mode) {
|
||||||
lyxerr[Debug::GRAPHICS] << "findTargetFormat: PDF mode\n";
|
lyxerr[Debug::GRAPHICS] << "findTargetFormat: PDF mode\n";
|
||||||
if (contains(suffix,"ps") || suffix == "pdf")
|
if (contains(suffix, "ps") || suffix == "pdf")
|
||||||
return "pdf";
|
return "pdf";
|
||||||
else if (suffix == "jpg") // pdflatex can use jpeg
|
else if (suffix == "jpg") // pdflatex can use jpeg
|
||||||
return suffix;
|
return suffix;
|
||||||
@ -729,11 +743,11 @@ string const InsetGraphics::prepareFile(Buffer const *buf) const
|
|||||||
// from ImageMagic: convert from:inname.from to:outname.to
|
// from ImageMagic: convert from:inname.from to:outname.to
|
||||||
if (!converters.convert(buf, temp_file, outfile_base, from, to)) {
|
if (!converters.convert(buf, temp_file, outfile_base, from, to)) {
|
||||||
string const command =
|
string const command =
|
||||||
"convert " +
|
LibFileSearch("scripts", "convertDefault.sh") +
|
||||||
from + ':' + temp_file + ' ' +
|
' ' + from + ':' + temp_file + ' ' +
|
||||||
to + ':' + outfile_base + '.' + to;
|
to + ':' + outfile_base + '.' + to;
|
||||||
lyxerr[Debug::GRAPHICS]
|
lyxerr[Debug::GRAPHICS]
|
||||||
<< "No converter defined! I use convert from ImageMagic:\n\t"
|
<< "No converter defined! I use convertDefault.sh:\n\t"
|
||||||
<< command << endl;
|
<< command << endl;
|
||||||
Systemcall one;
|
Systemcall one;
|
||||||
one.startscript(Systemcall::Wait, command);
|
one.startscript(Systemcall::Wait, command);
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include "insetgraphicsParams.h"
|
#include "insetgraphicsParams.h"
|
||||||
|
|
||||||
#include "graphics/GraphicsParams.h"
|
#include "graphics/GraphicsParams.h"
|
||||||
#include "graphics/GraphicsCache.h"
|
|
||||||
|
|
||||||
#include "support/translator.h"
|
#include "support/translator.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
@ -97,12 +96,12 @@ void InsetGraphicsParams::init()
|
|||||||
lyxheight = LyXLength(); // also set to 0pt
|
lyxheight = LyXLength(); // also set to 0pt
|
||||||
scale = 0; // unit is %
|
scale = 0; // unit is %
|
||||||
lyxscale = 0; // same for lyxview
|
lyxscale = 0; // same for lyxview
|
||||||
size_type = DEFAULT_SIZE; // do nothing
|
size_kind = DEFAULT_SIZE; // do nothing
|
||||||
lyxsize_type = DEFAULT_SIZE; // do nothing
|
lyxsize_kind = DEFAULT_SIZE; // do nothing
|
||||||
keepLyXAspectRatio = false; // only for LyXview
|
keepAspectRatio = false; // for latex
|
||||||
keepAspectRatio = false; // only for latex
|
keepLyXAspectRatio = false; // for lyx
|
||||||
rotate = false; // Rotating
|
rotate = false; // Rotating
|
||||||
rotateOrigin = "center"; // Origin
|
rotateOrigin = "leftBaseline"; // Origin
|
||||||
rotateAngle = 0.0; // in degrees
|
rotateAngle = 0.0; // in degrees
|
||||||
special = string(); // userdefined stuff
|
special = string(); // userdefined stuff
|
||||||
}
|
}
|
||||||
@ -121,12 +120,13 @@ void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
|
|||||||
width = igp.width;
|
width = igp.width;
|
||||||
height = igp.height;
|
height = igp.height;
|
||||||
scale = igp.scale;
|
scale = igp.scale;
|
||||||
size_type = igp.size_type;
|
size_kind = igp.size_kind;
|
||||||
lyxsize_type = igp.lyxsize_type;
|
lyxsize_kind = igp.lyxsize_kind;
|
||||||
lyxwidth = igp.lyxwidth;
|
lyxwidth = igp.lyxwidth;
|
||||||
lyxheight = igp.lyxheight;
|
lyxheight = igp.lyxheight;
|
||||||
keepLyXAspectRatio = igp.keepLyXAspectRatio;
|
keepLyXAspectRatio = igp.keepLyXAspectRatio;
|
||||||
lyxscale = igp.lyxscale;
|
lyxscale = igp.lyxscale;
|
||||||
|
keepLyXAspectRatio = igp.keepLyXAspectRatio;
|
||||||
rotate = igp.rotate;
|
rotate = igp.rotate;
|
||||||
rotateOrigin = igp.rotateOrigin;
|
rotateOrigin = igp.rotateOrigin;
|
||||||
rotateAngle = igp.rotateAngle;
|
rotateAngle = igp.rotateAngle;
|
||||||
@ -148,12 +148,13 @@ bool operator==(InsetGraphicsParams const & left,
|
|||||||
left.width == right.width &&
|
left.width == right.width &&
|
||||||
left.height == right.height &&
|
left.height == right.height &&
|
||||||
left.scale == right.scale &&
|
left.scale == right.scale &&
|
||||||
left.size_type == right.size_type &&
|
left.size_kind == right.size_kind &&
|
||||||
left.lyxsize_type == right.lyxsize_type &&
|
left.lyxsize_kind == right.lyxsize_kind &&
|
||||||
left.lyxwidth == right.lyxwidth &&
|
left.lyxwidth == right.lyxwidth &&
|
||||||
left.lyxheight == right.lyxheight &&
|
left.lyxheight == right.lyxheight &&
|
||||||
left.keepLyXAspectRatio == right.keepLyXAspectRatio &&
|
left.keepLyXAspectRatio == right.keepLyXAspectRatio &&
|
||||||
left.lyxscale == right.lyxscale &&
|
left.lyxscale == right.lyxscale &&
|
||||||
|
left.keepLyXAspectRatio == right.keepLyXAspectRatio &&
|
||||||
left.rotate == right.rotate &&
|
left.rotate == right.rotate &&
|
||||||
left.rotateOrigin == right.rotateOrigin &&
|
left.rotateOrigin == right.rotateOrigin &&
|
||||||
lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 &&
|
lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 &&
|
||||||
@ -171,6 +172,34 @@ bool operator!=(InsetGraphicsParams const & left,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
|
||||||
|
} //anon
|
||||||
|
|
||||||
|
|
||||||
void InsetGraphicsParams::Write(ostream & os) const
|
void InsetGraphicsParams::Write(ostream & os) const
|
||||||
{
|
{
|
||||||
// If there is no filename, write nothing for it.
|
// If there is no filename, write nothing for it.
|
||||||
@ -192,11 +221,7 @@ void InsetGraphicsParams::Write(ostream & os) const
|
|||||||
os << "\tsubcaptionText \"" << subcaptionText << '\"' << '\n';
|
os << "\tsubcaptionText \"" << subcaptionText << '\"' << '\n';
|
||||||
if (noUnzip)
|
if (noUnzip)
|
||||||
os << "\tnoUnzip\n";
|
os << "\tnoUnzip\n";
|
||||||
// we always need the size type
|
os << "\tsize_kind " << getSizeKindStr(size_kind) << '\n';
|
||||||
// 0: no special
|
|
||||||
// 1: width/height combination
|
|
||||||
// 2: scale
|
|
||||||
os << "\tsize_type " << size_type << '\n';
|
|
||||||
if (!width.zero())
|
if (!width.zero())
|
||||||
os << "\twidth " << width.asString() << '\n';
|
os << "\twidth " << width.asString() << '\n';
|
||||||
if (!height.zero())
|
if (!height.zero())
|
||||||
@ -214,7 +239,7 @@ void InsetGraphicsParams::Write(ostream & os) const
|
|||||||
if (!special.empty())
|
if (!special.empty())
|
||||||
os << "\tspecial " << special << '\n';
|
os << "\tspecial " << special << '\n';
|
||||||
// the values for the view in lyx
|
// the values for the view in lyx
|
||||||
os << "\tlyxsize_type " << lyxsize_type << '\n';
|
os << "\tlyxsize_kind " << getSizeKindStr(lyxsize_kind) << '\n';
|
||||||
if (!lyxwidth.zero()) // the lyx-viewsize
|
if (!lyxwidth.zero()) // the lyx-viewsize
|
||||||
os << "\tlyxwidth " << lyxwidth.asString() << '\n';
|
os << "\tlyxwidth " << lyxwidth.asString() << '\n';
|
||||||
if (!lyxheight.zero())
|
if (!lyxheight.zero())
|
||||||
@ -251,19 +276,9 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token)
|
|||||||
subcaptionText = lex.getString();
|
subcaptionText = lex.getString();
|
||||||
} else if (token == "noUnzip") {
|
} else if (token == "noUnzip") {
|
||||||
noUnzip = true;
|
noUnzip = true;
|
||||||
} else if (token == "size_type") {
|
} else if (token == "size_kind") {
|
||||||
lex.next();
|
lex.next();
|
||||||
switch (lex.getInteger()) {
|
size_kind = getSizeKind(lex.getString());
|
||||||
case 0:
|
|
||||||
size_type = DEFAULT_SIZE;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
size_type = WH;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
size_type = SCALE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (token == "width") {
|
} else if (token == "width") {
|
||||||
lex.next();
|
lex.next();
|
||||||
width = LyXLength(lex.getString());
|
width = LyXLength(lex.getString());
|
||||||
@ -283,19 +298,9 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token)
|
|||||||
} else if (token == "rotateOrigin") {
|
} else if (token == "rotateOrigin") {
|
||||||
lex.next();
|
lex.next();
|
||||||
rotateOrigin=lex.getString();
|
rotateOrigin=lex.getString();
|
||||||
} else if (token == "lyxsize_type") {
|
} else if (token == "lyxsize_kind") {
|
||||||
lex.next();
|
lex.next();
|
||||||
switch (lex.getInteger()) {
|
lyxsize_kind = getSizeKind(lex.getString());
|
||||||
case 0:
|
|
||||||
lyxsize_type = DEFAULT_SIZE;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
lyxsize_type = WH;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
lyxsize_type = SCALE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (token == "lyxwidth") {
|
} else if (token == "lyxwidth") {
|
||||||
lex.next();
|
lex.next();
|
||||||
lyxwidth = LyXLength(lex.getString());
|
lyxwidth = LyXLength(lex.getString());
|
||||||
@ -400,14 +405,14 @@ grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const
|
|||||||
pars.display = grfx::NoDisplay;
|
pars.display = grfx::NoDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lyxsize_type == InsetGraphicsParams::SCALE) {
|
if (lyxsize_kind == InsetGraphicsParams::SCALE) {
|
||||||
pars.scale = lyxscale;
|
pars.scale = lyxscale;
|
||||||
|
|
||||||
} else if (lyxsize_type == InsetGraphicsParams::WH) {
|
} else if (lyxsize_kind == InsetGraphicsParams::WH) {
|
||||||
pars.width = lyxwidth.inBP();
|
pars.width = lyxwidth.inBP();
|
||||||
pars.height = lyxheight.inBP();
|
pars.height = lyxheight.inBP();
|
||||||
pars.keepLyXAspectRatio = keepLyXAspectRatio;
|
pars.keepLyXAspectRatio = keepLyXAspectRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pars;
|
return pars;
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,10 @@ struct InsetGraphicsParams
|
|||||||
NONE // only keep a frame in place.
|
NONE // only keep a frame in place.
|
||||||
};
|
};
|
||||||
///
|
///
|
||||||
enum sizeType { // for latex and/or lyx
|
enum sizeKind { // for latex and/or lyx
|
||||||
DEFAULT_SIZE, // like none
|
DEFAULT_SIZE, // like none
|
||||||
WH, // width/height values
|
SCALE, // percentage value
|
||||||
SCALE // percentage value
|
WH // width/height values
|
||||||
};
|
};
|
||||||
/// Image filename.
|
/// Image filename.
|
||||||
string filename;
|
string filename;
|
||||||
@ -64,7 +64,7 @@ struct InsetGraphicsParams
|
|||||||
/// The bounding box with "xLB yLB yRT yRT ", divided by a space!
|
/// The bounding box with "xLB yLB yRT yRT ", divided by a space!
|
||||||
string bb;
|
string bb;
|
||||||
/// Type of rescaling
|
/// Type of rescaling
|
||||||
sizeType size_type;
|
sizeKind size_kind;
|
||||||
/// three possible values for rescaling (latex)
|
/// three possible values for rescaling (latex)
|
||||||
LyXLength width;
|
LyXLength width;
|
||||||
///
|
///
|
||||||
@ -77,10 +77,10 @@ struct InsetGraphicsParams
|
|||||||
string special;
|
string special;
|
||||||
/// How to display the image inside lyx
|
/// How to display the image inside lyx
|
||||||
DisplayType display;
|
DisplayType display;
|
||||||
/// Typ of the LyXView, same as for latex
|
|
||||||
sizeType lyxsize_type;
|
|
||||||
/// the size for the view inside lyx
|
/// the size for the view inside lyx
|
||||||
LyXLength lyxwidth;
|
LyXLength lyxwidth;
|
||||||
|
/// Typ of the LyXView, same as for latex
|
||||||
|
sizeKind lyxsize_kind;
|
||||||
///
|
///
|
||||||
LyXLength lyxheight;
|
LyXLength lyxheight;
|
||||||
/// Keep the ratio between lyxheight and lyxwidth when resizing.
|
/// Keep the ratio between lyxheight and lyxwidth when resizing.
|
||||||
|
@ -8,7 +8,8 @@ int const num_units = LyXLength::UNIT_NONE;
|
|||||||
char const * unit_name[num_units] = {
|
char const * unit_name[num_units] = {
|
||||||
"sp", "pt", "bp", "dd", "mm", "pc", "cc", "cm",
|
"sp", "pt", "bp", "dd", "mm", "pc", "cc", "cm",
|
||||||
"in", "ex", "em", "mu",
|
"in", "ex", "em", "mu",
|
||||||
"text%", "col%", "page%", "line%" };
|
"text%", "col%", "page%", "line%",
|
||||||
|
"theight%", "pheight%" };
|
||||||
|
|
||||||
|
|
||||||
LyXLength::UNIT unitFromString(string const & data)
|
LyXLength::UNIT unitFromString(string const & data)
|
||||||
|
@ -47,7 +47,8 @@ string const convertOldRelLength(string const & oldLength)
|
|||||||
return subst(oldLength,"c%","col%");
|
return subst(oldLength,"c%","col%");
|
||||||
|
|
||||||
} else if (oldLength.find("t%") != string::npos) {
|
} else if (oldLength.find("t%") != string::npos) {
|
||||||
if (oldLength.find("text%") != string::npos)
|
if (oldLength.find("text%") != string::npos ||
|
||||||
|
oldLength.find("height%") != string::npos)
|
||||||
return oldLength;
|
return oldLength;
|
||||||
else
|
else
|
||||||
return subst(oldLength,"t%","text%");
|
return subst(oldLength,"t%","text%");
|
||||||
@ -113,6 +114,14 @@ string const LyXLength::asLatexString() const
|
|||||||
buffer << abs(static_cast<int>(val_/100)) << "."
|
buffer << abs(static_cast<int>(val_/100)) << "."
|
||||||
<< abs(static_cast<int>(val_)%100) << "\\linewidth";
|
<< abs(static_cast<int>(val_)%100) << "\\linewidth";
|
||||||
break;
|
break;
|
||||||
|
case PH:
|
||||||
|
buffer << abs(static_cast<int>(val_/100)) << "."
|
||||||
|
<< abs(static_cast<int>(val_)%100) << "\\paperheight";
|
||||||
|
break;
|
||||||
|
case TH:
|
||||||
|
buffer << abs(static_cast<int>(val_/100)) << "."
|
||||||
|
<< abs(static_cast<int>(val_)%100) << "\\textheight";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
buffer << val_ << unit_name[unit_]; // setw?
|
buffer << val_ << unit_name[unit_]; // setw?
|
||||||
break;
|
break;
|
||||||
@ -235,6 +244,10 @@ int LyXLength::inPixels(int default_width, int default_height) const
|
|||||||
case LyXLength::PL:
|
case LyXLength::PL:
|
||||||
result = val_ * default_width / 100;
|
result = val_ * default_width / 100;
|
||||||
break;
|
break;
|
||||||
|
case LyXLength::PH:
|
||||||
|
case LyXLength::TH:
|
||||||
|
result = val_ * default_height / 100;
|
||||||
|
break;
|
||||||
case LyXLength::UNIT_NONE:
|
case LyXLength::UNIT_NONE:
|
||||||
result = 0; // this cannot happen
|
result = 0; // this cannot happen
|
||||||
break;
|
break;
|
||||||
|
@ -36,10 +36,12 @@ public:
|
|||||||
EX, ///< Height of a small "x" for the current font.
|
EX, ///< Height of a small "x" for the current font.
|
||||||
EM, ///< Width of capital "M" in current font.
|
EM, ///< Width of capital "M" in current font.
|
||||||
MU, ///< Math unit (18mu = 1em) for positioning in math mode
|
MU, ///< Math unit (18mu = 1em) for positioning in math mode
|
||||||
PW, ///< Percent of columnwidth both "%" or "%c"
|
PW, ///< Percent of columnwidth
|
||||||
PE, ///< FIXME
|
PE, ///< Percent of textwidth
|
||||||
PP, ///< Percent of pagewidth
|
PP, ///< Percent of pagewidth
|
||||||
PL, ///< Percent of linewidth
|
PL, ///< Percent of linewidth
|
||||||
|
TH, ///< Percent of textheight // Herbert 2002-05-16
|
||||||
|
PH, ///< Percent of paperheight // Herbert 2002-05-16
|
||||||
UNIT_NONE ///< no unit
|
UNIT_NONE ///< no unit
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user