mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
(Rob Lahaye): changes to the xforms graphics dialog.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5495 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fd2740ca18
commit
e1edfbe8a0
@ -1,3 +1,7 @@
|
|||||||
|
2002-10-24 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* FORMAT: document further change to InsetGraphicsParams.
|
||||||
|
|
||||||
2002-10-23 Angus Leeming <leeming@lyx.org>
|
2002-10-23 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* tools/mkdoclinks.sh: new file. Run in <source>/lib/doc to
|
* tools/mkdoclinks.sh: new file. Run in <source>/lib/doc to
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
Changes to the LyX format since version 220 (LyX 1.2.0) was released.
|
Changes to the LyX format since version 220 (LyX 1.2.0) was released.
|
||||||
=====================================================================
|
=====================================================================
|
||||||
|
|
||||||
|
2002-10-24 Rob Lahaye <lahaye@snu.ac.kr>
|
||||||
|
|
||||||
|
* insetgraphicsParams.h (scale): is now a float, not an unsigned int.
|
||||||
|
|
||||||
2002-08-22 Rob Lahaye <lahaye@snu.ac.kr>
|
2002-08-22 Rob Lahaye <lahaye@snu.ac.kr>
|
||||||
|
|
||||||
New graphics dialog. With the removal of buttons in the dialog, also
|
New graphics dialog. With the removal of buttons in the dialog, also
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2002-10-24 Rob Lahaye <lahaye@snu.ac.kr>
|
||||||
|
|
||||||
|
* FormGraphics.C: use checkedWidgets to ensure that the lengths and
|
||||||
|
glue lengths are valid. Improve code documentation and layout.
|
||||||
|
InsetGraphicsParams::scale is now a float; modify dialog to suit.
|
||||||
|
|
||||||
|
* forms/form_graphics.fd: remove text_warning widget. Reshape.
|
||||||
|
|
||||||
2002-10-24 Rob Lahaye <lahaye@snu.ac.kr>
|
2002-10-24 Rob Lahaye <lahaye@snu.ac.kr>
|
||||||
|
|
||||||
* FormFloat.C (input): fix the radio buttongroup behaviour.
|
* FormFloat.C (input): fix the radio buttongroup behaviour.
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
*
|
*
|
||||||
* \author Baruch Even
|
* \author Baruch Even
|
||||||
* \author Herbert Voss
|
* \author Herbert Voss
|
||||||
|
* \author Rob Lahaye
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS
|
* Full author contact details are available in file CREDITS
|
||||||
*/
|
*/
|
||||||
@ -19,22 +20,30 @@
|
|||||||
#include "ControlGraphics.h"
|
#include "ControlGraphics.h"
|
||||||
#include "FormGraphics.h"
|
#include "FormGraphics.h"
|
||||||
#include "forms/form_graphics.h"
|
#include "forms/form_graphics.h"
|
||||||
#include "Alert.h"
|
|
||||||
#include "Tooltips.h"
|
|
||||||
|
|
||||||
#include "xforms_helpers.h"
|
#include "checkedwidgets.h"
|
||||||
#include "helper_funcs.h"
|
|
||||||
#include "input_validators.h"
|
#include "input_validators.h"
|
||||||
|
#include "Tooltips.h"
|
||||||
|
#include "xforms_helpers.h"
|
||||||
|
|
||||||
#include "debug.h" // for lyxerr
|
#include "debug.h" // for lyxerr
|
||||||
|
#include "lyxrc.h" // for lyxrc.display_graphics
|
||||||
|
|
||||||
|
#include "insets/insetgraphicsParams.h"
|
||||||
|
|
||||||
|
#include "controllers/helper_funcs.h" // for getStringFromVector
|
||||||
|
|
||||||
|
#include "frontends/Alert.h"
|
||||||
|
|
||||||
#include "support/lstrings.h" // for strToDbl & tostr
|
#include "support/lstrings.h" // for strToDbl & tostr
|
||||||
#include "support/filetools.h" // for MakeAbsPath etc
|
#include "support/filetools.h" // for MakeAbsPath etc
|
||||||
#include "insets/insetgraphicsParams.h"
|
|
||||||
#include "lyxrc.h" // for lyxrc.display_graphics
|
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Bound the number of input characters
|
// Bound the number of input characters
|
||||||
@ -43,12 +52,6 @@ int const FILENAME_MAXCHARS = 1024;
|
|||||||
|
|
||||||
string defaultUnit("cm");
|
string defaultUnit("cm");
|
||||||
|
|
||||||
/// Given input and choice widgets, create a LyXLength
|
|
||||||
LyXLength getLyXLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice)
|
|
||||||
{
|
|
||||||
return LyXLength(getLengthFromWidgets(input, choice));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace anon
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
@ -75,9 +78,6 @@ void FormGraphics::build()
|
|||||||
{
|
{
|
||||||
dialog_.reset(build_graphics(this));
|
dialog_.reset(build_graphics(this));
|
||||||
|
|
||||||
// Allow the base class to control messages
|
|
||||||
setMessageWidget(dialog_->text_warning);
|
|
||||||
|
|
||||||
// Manage the ok, apply, restore and cancel/close buttons
|
// Manage the ok, apply, restore and cancel/close buttons
|
||||||
bc().setOK(dialog_->button_ok);
|
bc().setOK(dialog_->button_ok);
|
||||||
bc().setApply(dialog_->button_apply);
|
bc().setApply(dialog_->button_apply);
|
||||||
@ -87,24 +87,37 @@ void FormGraphics::build()
|
|||||||
// the file section
|
// the file section
|
||||||
file_.reset(build_graphics_file(this));
|
file_.reset(build_graphics_file(this));
|
||||||
|
|
||||||
fl_set_input_return (file_->input_filename, FL_RETURN_CHANGED);
|
// disable for read-only documents
|
||||||
fl_set_input_return (file_->input_lyxscale, FL_RETURN_CHANGED);
|
bc().addReadOnly(file_->button_browse);
|
||||||
fl_set_input_return (file_->input_width, FL_RETURN_CHANGED);
|
bc().addReadOnly(file_->check_aspectratio);
|
||||||
fl_set_input_return (file_->input_height, FL_RETURN_CHANGED);
|
bc().addReadOnly(file_->check_draft);
|
||||||
|
bc().addReadOnly(file_->check_nounzip);
|
||||||
|
|
||||||
|
// check validity of "length + unit" input
|
||||||
|
addCheckedGlueLength(bc(), file_->input_width);
|
||||||
|
addCheckedGlueLength(bc(), file_->input_height);
|
||||||
|
|
||||||
|
// trigger an input event for cut&paste with middle mouse button.
|
||||||
setPrehandler(file_->input_filename);
|
setPrehandler(file_->input_filename);
|
||||||
setPrehandler(file_->input_lyxscale);
|
setPrehandler(file_->input_lyxscale);
|
||||||
setPrehandler(file_->input_width);
|
setPrehandler(file_->input_width);
|
||||||
setPrehandler(file_->input_height);
|
setPrehandler(file_->input_height);
|
||||||
|
|
||||||
|
// for activate ok/apply immediately upon input
|
||||||
|
fl_set_input_return(file_->input_filename, FL_RETURN_CHANGED);
|
||||||
|
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);
|
||||||
|
|
||||||
fl_set_input_maxchars(file_->input_filename, FILENAME_MAXCHARS);
|
fl_set_input_maxchars(file_->input_filename, FILENAME_MAXCHARS);
|
||||||
fl_set_input_filter(file_->input_lyxscale, fl_unsigned_int_filter);
|
fl_set_input_filter(file_->input_lyxscale, fl_unsigned_float_filter);
|
||||||
|
|
||||||
// width default is scaling, thus unsigned integer input
|
// 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_width, fl_unsigned_int_filter);
|
||||||
fl_set_input_maxchars(file_->input_height, SIZE_MAXDIGITS);
|
fl_set_input_maxchars(file_->input_height, SIZE_MAXDIGITS);
|
||||||
|
|
||||||
string const display_List = _("Default|Monochrome|Grayscale|Color|Do not display");
|
string const display_List =
|
||||||
|
_("Default|Monochrome|Grayscale|Color|Do not display");
|
||||||
fl_addto_choice(file_->choice_display, display_List.c_str());
|
fl_addto_choice(file_->choice_display, display_List.c_str());
|
||||||
|
|
||||||
string const width_list = _("Scale%%|") + choice_Length_All;
|
string const width_list = _("Scale%%|") + choice_Length_All;
|
||||||
@ -112,98 +125,107 @@ void FormGraphics::build()
|
|||||||
|
|
||||||
fl_addto_choice(file_->choice_height, 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_aspectratio);
|
|
||||||
bc().addReadOnly(file_->check_draft);
|
|
||||||
bc().addReadOnly(file_->check_nounzip);
|
|
||||||
|
|
||||||
// set up the tooltips for the filesection
|
// set up the tooltips for the filesection
|
||||||
string str = _("The file you want to insert.");
|
string str = _("The file you want to insert");
|
||||||
tooltips().init(file_->input_filename, str);
|
tooltips().init(file_->input_filename, str);
|
||||||
str = _("Browse the directories.");
|
str = _("Browse the directories");
|
||||||
tooltips().init(file_->button_browse, str);
|
tooltips().init(file_->button_browse, str);
|
||||||
|
|
||||||
str = _("Scale the image to inserted percentage value.");
|
str = _("Scale the image to inserted percentage value");
|
||||||
tooltips().init(file_->input_lyxscale, str);
|
tooltips().init(file_->input_lyxscale, str);
|
||||||
str = _("Select display mode for this image.");
|
str = _("Select display mode for this image");
|
||||||
tooltips().init(file_->choice_display, str);
|
tooltips().init(file_->choice_display, str);
|
||||||
|
|
||||||
str = _("Set the image width to the inserted value.");
|
str = _("Set the image width to the inserted value");
|
||||||
tooltips().init(file_->input_width, str);
|
tooltips().init(file_->input_width, str);
|
||||||
str = _("Select unit for width; Scale% for scaling whole image.");
|
str = _("Select unit for width; Scale% for scaling whole image");
|
||||||
tooltips().init(file_->choice_width, str);
|
tooltips().init(file_->choice_width, str);
|
||||||
str = _("Set the image height to the inserted value.");
|
str = _("Set the image height to the inserted value");
|
||||||
tooltips().init(file_->input_height, str);
|
tooltips().init(file_->input_height, str);
|
||||||
str = _("Select unit for height");
|
str = _("Select unit for height");
|
||||||
tooltips().init(file_->choice_height, str);
|
tooltips().init(file_->choice_height, str);
|
||||||
str = _("Do not distort the image. "
|
str = _("Do not distort the image. "
|
||||||
"Keep image within \"width\" by \"height\" and obey aspect ratio.");
|
"Keep image within \"width\" by \"height\" and obey "
|
||||||
|
"aspect ratio");
|
||||||
tooltips().init(file_->check_aspectratio, str);
|
tooltips().init(file_->check_aspectratio, str);
|
||||||
|
|
||||||
str = _("Pass a filename like \"file.eps.gz\" to the LaTeX output. "
|
str = _("Pass a filename like \"file.eps.gz\" to the LaTeX output. "
|
||||||
"Useful when LaTeX should unzip the file. Needs an additional file "
|
"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);
|
tooltips().init(file_->check_nounzip, str);
|
||||||
|
str = _("Show image only as a rectangle of the original size");
|
||||||
str = _("Show image only as a rectangle of the original size.");
|
|
||||||
tooltips().init(file_->check_draft, str);
|
tooltips().init(file_->check_draft, 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_y0, 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);
|
// disable for read-only documents
|
||||||
fl_set_input_filter(bbox_->input_bb_y0, fl_unsigned_float_filter);
|
bc().addReadOnly(bbox_->button_getBB);
|
||||||
fl_set_input_filter(bbox_->input_bb_x1, fl_unsigned_float_filter);
|
bc().addReadOnly(bbox_->check_clip);
|
||||||
fl_set_input_filter(bbox_->input_bb_y1, fl_unsigned_float_filter);
|
|
||||||
|
|
||||||
|
// check validity of "length + unit" input
|
||||||
|
addCheckedLyXLength(bc(), bbox_->input_bb_x1, bbox_->text_X);
|
||||||
|
|
||||||
|
// trigger an input event for cut&paste with middle mouse button.
|
||||||
setPrehandler(bbox_->input_bb_x0);
|
setPrehandler(bbox_->input_bb_x0);
|
||||||
setPrehandler(bbox_->input_bb_y0);
|
setPrehandler(bbox_->input_bb_y0);
|
||||||
setPrehandler(bbox_->input_bb_x1);
|
setPrehandler(bbox_->input_bb_x1);
|
||||||
setPrehandler(bbox_->input_bb_y1);
|
setPrehandler(bbox_->input_bb_y1);
|
||||||
|
|
||||||
|
// for activate ok/apply immediately upon input
|
||||||
|
fl_set_input_return(bbox_->input_bb_x0, FL_RETURN_CHANGED);
|
||||||
|
fl_set_input_return(bbox_->input_bb_y0, 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_y1, fl_unsigned_float_filter);
|
||||||
|
|
||||||
string const bb_units = "bp|cm|mm|in";
|
string const bb_units = "bp|cm|mm|in";
|
||||||
fl_addto_choice(bbox_->choice_bb_units, bb_units.c_str());
|
fl_addto_choice(bbox_->choice_bb_units, bb_units.c_str());
|
||||||
bc().addReadOnly(bbox_->button_getBB);
|
|
||||||
bc().addReadOnly(bbox_->check_clip);
|
|
||||||
|
|
||||||
// set up the tooltips for the bounding-box-section
|
// set up the tooltips for the bounding-box-section
|
||||||
str = _("The lower left x-value of the bounding box");
|
str = _("The lower left x-value of the bounding box");
|
||||||
tooltips().init(bbox_->input_bb_x0, str);
|
tooltips().init(bbox_->input_bb_x0, str);
|
||||||
str = _("The lower left y-value of the bounding box");
|
str = _("The lower left y-value of the bounding box");
|
||||||
tooltips().init(bbox_->input_bb_y0, str);
|
tooltips().init(bbox_->input_bb_y0, str);
|
||||||
str = _("The upper right x-value of the bounding box");
|
str = _("The upper right x-value of the bounding box; "
|
||||||
|
"only this input field allows length + unit, e.g. 5cm "
|
||||||
|
"and sets the unit for the other input fields");
|
||||||
tooltips().init(bbox_->input_bb_x1, str);
|
tooltips().init(bbox_->input_bb_x1, str);
|
||||||
str = _("The upper right y-value of the bounding box");
|
str = _("The upper right y-value of the bounding box");
|
||||||
tooltips().init(bbox_->input_bb_y1, str);
|
tooltips().init(bbox_->input_bb_y1, str);
|
||||||
str = _("Select unit for the bounding box values");
|
str = _("Select unit for the bounding box values");
|
||||||
tooltips().init(bbox_->choice_bb_units, str);
|
tooltips().init(bbox_->choice_bb_units, str);
|
||||||
|
|
||||||
str = _("Read the image coordinates new from file. If it's an (e)ps-file "
|
str = _("Read the image coordinates new from file. For (e)ps-file "
|
||||||
"then the bounding box is read otherwise the imagesize in pixels. "
|
"the bounding box is read, otherwise the imagesize in pixels. "
|
||||||
"Default unit is \"bp\", the PostScript's b(ig) p(oint).");
|
"Default unit is \"bp\", the PostScript's b(ig) p(oint)");
|
||||||
tooltips().init(bbox_->button_getBB, str);
|
tooltips().init(bbox_->button_getBB, str);
|
||||||
|
|
||||||
str = _("Clip image to the bounding box values.");
|
str = _("Clip image to the bounding box values");
|
||||||
tooltips().init(bbox_->check_clip, str);
|
tooltips().init(bbox_->check_clip, str);
|
||||||
|
|
||||||
// the extra section
|
// the extra section
|
||||||
extra_.reset(build_graphics_extra(this));
|
extra_.reset(build_graphics_extra(this));
|
||||||
|
|
||||||
fl_set_input_return (extra_->input_rotate_angle, FL_RETURN_CHANGED);
|
// disable for read-only documents
|
||||||
fl_set_input_return (extra_->input_subcaption, FL_RETURN_CHANGED);
|
bc().addReadOnly(extra_->input_rotate_angle);
|
||||||
fl_set_input_return (extra_->input_special, FL_RETURN_CHANGED);
|
bc().addReadOnly(extra_->choice_origin);
|
||||||
|
bc().addReadOnly(extra_->check_subcaption);
|
||||||
fl_set_input_filter(extra_->input_rotate_angle, fl_float_filter);
|
bc().addReadOnly(extra_->input_special);
|
||||||
|
|
||||||
|
// trigger an input event for cut&paste with middle mouse button.
|
||||||
setPrehandler(extra_->input_rotate_angle);
|
setPrehandler(extra_->input_rotate_angle);
|
||||||
setPrehandler(extra_->input_subcaption);
|
setPrehandler(extra_->input_subcaption);
|
||||||
setPrehandler(extra_->input_special);
|
setPrehandler(extra_->input_special);
|
||||||
|
|
||||||
bc().addReadOnly(extra_->check_subcaption);
|
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_filter(extra_->input_rotate_angle, fl_float_filter);
|
||||||
|
|
||||||
using namespace frnt;
|
using namespace frnt;
|
||||||
vector<RotationOriginPair> origindata = getRotationOriginData();
|
vector<RotationOriginPair> origindata = getRotationOriginData();
|
||||||
@ -216,16 +238,17 @@ void FormGraphics::build()
|
|||||||
|
|
||||||
// set up the tooltips for the extra section
|
// set up the tooltips for the extra section
|
||||||
str = _("Insert the rotation angle in degrees. "
|
str = _("Insert the rotation angle in degrees. "
|
||||||
"Positive value rotates anti-clockwise, negative value clockwise.");
|
"Positive value rotates anti-clockwise, "
|
||||||
|
"negative value clockwise");
|
||||||
tooltips().init(extra_->input_rotate_angle, str);
|
tooltips().init(extra_->input_rotate_angle, str);
|
||||||
str = _("Insert the point of origin for rotation.");
|
str = _("Insert the point of origin for rotation");
|
||||||
tooltips().init(extra_->choice_origin, str);
|
tooltips().init(extra_->choice_origin, str);
|
||||||
str = _("Enables use of subfigure with its own caption.");
|
str = _("Enables use of subfigure with its own caption");
|
||||||
tooltips().init(extra_->check_subcaption, str);
|
tooltips().init(extra_->check_subcaption, str);
|
||||||
str = _("Insert the optional subfigure caption.");
|
str = _("Insert the optional subfigure caption");
|
||||||
tooltips().init(extra_->input_subcaption, str);
|
tooltips().init(extra_->input_subcaption, str);
|
||||||
str = _("Add any additional latex option, which is defined in the "
|
str = _("Add any additional latex option, which is defined in the "
|
||||||
"graphicx-package and not mentioned in the gui's tabfolders.");
|
"graphicx-package and not mentioned in the gui's tabfolders");
|
||||||
tooltips().init(extra_->input_special, str);
|
tooltips().init(extra_->input_special, str);
|
||||||
|
|
||||||
// add the different tabfolders
|
// add the different tabfolders
|
||||||
@ -264,58 +287,95 @@ void FormGraphics::apply()
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (fl_get_choice(file_->choice_display)) {
|
switch (fl_get_choice(file_->choice_display)) {
|
||||||
case 5: igp.display = grfx::NoDisplay; break;
|
case 5:
|
||||||
case 4: igp.display = grfx::ColorDisplay; break;
|
igp.display = grfx::NoDisplay;
|
||||||
case 3: igp.display = grfx::GrayscaleDisplay; break;
|
break;
|
||||||
case 2: igp.display = grfx::MonochromeDisplay; break;
|
case 4:
|
||||||
case 1:
|
igp.display = grfx::ColorDisplay;
|
||||||
default: igp.display = grfx::DefaultDisplay;
|
break;
|
||||||
|
case 3:
|
||||||
|
igp.display = grfx::GrayscaleDisplay;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
igp.display = grfx::MonochromeDisplay;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
igp.display = grfx::DefaultDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
// first item in choice_width means scaling
|
// first item in choice_width means scaling
|
||||||
if (fl_get_choice(file_->choice_width) == 1) {
|
if (fl_get_choice(file_->choice_width) == 1) {
|
||||||
igp.scale = strToInt(getString(file_->input_width));
|
igp.scale = strToDbl(getString(file_->input_width));
|
||||||
if (igp.scale == 0) {
|
if (igp.scale == 0.0) {
|
||||||
igp.scale = 100;
|
igp.scale = 100.0;
|
||||||
}
|
}
|
||||||
igp.width = LyXLength();
|
igp.width = LyXLength();
|
||||||
} else {
|
} else {
|
||||||
igp.scale = 0;
|
igp.scale = 0.0;
|
||||||
igp.width = getLyXLengthFromWidgets(file_->input_width,
|
igp.width = LyXLength(getLengthFromWidgets(file_->input_width,
|
||||||
file_->choice_width);
|
file_->choice_width));
|
||||||
}
|
}
|
||||||
igp.height = getLyXLengthFromWidgets(file_->input_height,
|
igp.height = LyXLength(getLengthFromWidgets(file_->input_height,
|
||||||
file_->choice_height);
|
file_->choice_height));
|
||||||
igp.keepAspectRatio = fl_get_button(file_->check_aspectratio);
|
igp.keepAspectRatio = fl_get_button(file_->check_aspectratio);
|
||||||
|
|
||||||
igp.draft = fl_get_button(file_->check_draft);
|
igp.draft = fl_get_button(file_->check_draft);
|
||||||
igp.noUnzip = fl_get_button(file_->check_nounzip);
|
igp.noUnzip = fl_get_button(file_->check_nounzip);
|
||||||
|
|
||||||
// the bb section
|
// the bb section
|
||||||
if (!controller().bbChanged) { // different to the original one?
|
if (!controller().bbChanged) {
|
||||||
igp.bb = string(); // don't write anything
|
// don't write anything
|
||||||
|
igp.bb.erase();
|
||||||
} else {
|
} else {
|
||||||
|
// allow length + unit input only for x1 input field
|
||||||
|
string x1_str = "0";
|
||||||
|
if (!getString(bbox_->input_bb_x1).empty()) {
|
||||||
|
x1_str = getLengthFromWidgets(bbox_->input_bb_x1,
|
||||||
|
bbox_->choice_bb_units);
|
||||||
|
LyXLength x1 = LyXLength(x1_str);
|
||||||
|
x1_str = x1.asString();
|
||||||
|
|
||||||
|
string unit;
|
||||||
|
switch (x1.unit()) {
|
||||||
|
case LyXLength::IN:
|
||||||
|
unit = "in";
|
||||||
|
break;
|
||||||
|
case LyXLength::MM:
|
||||||
|
unit = "mm";
|
||||||
|
break;
|
||||||
|
case LyXLength::CM:
|
||||||
|
unit = "cm";
|
||||||
|
break;
|
||||||
|
case LyXLength::BP:
|
||||||
|
default:
|
||||||
|
unit = "bp";
|
||||||
|
}
|
||||||
|
fl_set_choice_text(bbox_->choice_bb_units, unit.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
string bb;
|
string bb;
|
||||||
if (getString(bbox_->input_bb_x0).empty())
|
if (getString(bbox_->input_bb_x0).empty())
|
||||||
bb = "0 ";
|
bb = "0";
|
||||||
else
|
else
|
||||||
bb = getLengthFromWidgets(bbox_->input_bb_x0,
|
bb = getLengthFromWidgets(bbox_->input_bb_x0,
|
||||||
bbox_->choice_bb_units)+" ";
|
bbox_->choice_bb_units);
|
||||||
|
|
||||||
|
bb += " ";
|
||||||
|
|
||||||
if (getString(bbox_->input_bb_y0).empty())
|
if (getString(bbox_->input_bb_y0).empty())
|
||||||
bb += "0 ";
|
bb += "0";
|
||||||
else
|
else
|
||||||
bb += (getLengthFromWidgets(bbox_->input_bb_y0,
|
bb += getLengthFromWidgets(bbox_->input_bb_y0,
|
||||||
bbox_->choice_bb_units)+" ");
|
bbox_->choice_bb_units);
|
||||||
if (getString(bbox_->input_bb_x1).empty())
|
|
||||||
bb += "0 ";
|
bb += " " + x1_str + " ";
|
||||||
else
|
|
||||||
bb += (getLengthFromWidgets(bbox_->input_bb_x1,
|
|
||||||
bbox_->choice_bb_units)+" ");
|
|
||||||
if (getString(bbox_->input_bb_y1).empty())
|
if (getString(bbox_->input_bb_y1).empty())
|
||||||
bb += "0 ";
|
bb += "0";
|
||||||
else
|
else
|
||||||
bb += (getLengthFromWidgets(bbox_->input_bb_y1,
|
bb += getLengthFromWidgets(bbox_->input_bb_y1,
|
||||||
bbox_->choice_bb_units)+" ");
|
bbox_->choice_bb_units);
|
||||||
|
|
||||||
igp.bb = bb;
|
igp.bb = bb;
|
||||||
}
|
}
|
||||||
igp.clip = fl_get_button(bbox_->check_clip);
|
igp.clip = fl_get_button(bbox_->check_clip);
|
||||||
@ -355,40 +415,50 @@ void FormGraphics::update() {
|
|||||||
fl_set_input(file_->input_lyxscale, tostr(igp.lyxscale).c_str());
|
fl_set_input(file_->input_lyxscale, tostr(igp.lyxscale).c_str());
|
||||||
|
|
||||||
switch (igp.display) {
|
switch (igp.display) {
|
||||||
case grfx::NoDisplay: fl_set_choice(file_->choice_display, 5); break;
|
case grfx::NoDisplay:
|
||||||
case grfx::ColorDisplay: fl_set_choice(file_->choice_display, 4); break;
|
fl_set_choice(file_->choice_display, 5);
|
||||||
case grfx::GrayscaleDisplay: fl_set_choice(file_->choice_display, 3); break;
|
break;
|
||||||
case grfx::MonochromeDisplay: fl_set_choice(file_->choice_display, 2); break;
|
case grfx::ColorDisplay:
|
||||||
case grfx::DefaultDisplay:
|
fl_set_choice(file_->choice_display, 4);
|
||||||
default: fl_set_choice(file_->choice_display, 1);
|
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:
|
||||||
|
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
|
// set width input fields according to scaling or width/height input
|
||||||
if (igp.scale) {
|
if (igp.scale) {
|
||||||
fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
|
fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
|
||||||
fl_set_input_maxchars(file_->input_width, 0);
|
fl_set_input_maxchars(file_->input_width, 0);
|
||||||
fl_set_input(file_->input_width, tostr(igp.scale).c_str());
|
fl_set_input(file_->input_width, tostr(igp.scale).c_str());
|
||||||
fl_set_choice(file_->choice_width, 1);
|
fl_set_choice(file_->choice_width, 1);
|
||||||
} else {
|
} else {
|
||||||
fl_set_input_filter(file_->input_width, NULL);
|
fl_set_input_filter(file_->input_width, NULL);
|
||||||
fl_set_input_maxchars(file_->input_width, SIZE_MAXDIGITS);
|
fl_set_input_maxchars(file_->input_width, SIZE_MAXDIGITS);
|
||||||
updateWidgetsFromLength(file_->input_width,
|
updateWidgetsFromLength(file_->input_width, file_->choice_width,
|
||||||
file_->choice_width, igp.width, defaultUnit);
|
igp.width, defaultUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWidgetsFromLength(file_->input_height,
|
updateWidgetsFromLength(file_->input_height, file_->choice_height,
|
||||||
file_->choice_height, igp.height, defaultUnit);
|
igp.height, defaultUnit);
|
||||||
|
|
||||||
|
// disable height input in case of scaling
|
||||||
|
bool const disable_height = igp.scale != 0.0;
|
||||||
|
setEnabled(file_->input_height, !disable_height);
|
||||||
|
setEnabled(file_->choice_height, !disable_height);
|
||||||
|
|
||||||
fl_set_button(file_->check_aspectratio, igp.keepAspectRatio);
|
fl_set_button(file_->check_aspectratio, igp.keepAspectRatio);
|
||||||
fl_set_button(file_->check_draft, igp.draft);
|
fl_set_button(file_->check_draft, igp.draft);
|
||||||
fl_set_button(file_->check_nounzip, igp.noUnzip);
|
fl_set_button(file_->check_nounzip, igp.noUnzip);
|
||||||
|
|
||||||
// disable aspectratio button in case of scaling or one of width/height is empty
|
// disable aspectratio button in case of scaling or one of width/height
|
||||||
bool const disable_aspectRatio = igp.scale ||
|
// is empty
|
||||||
|
bool const disable_aspectRatio = disable_height ||
|
||||||
getString(file_->input_width).empty() ||
|
getString(file_->input_width).empty() ||
|
||||||
getString(file_->input_height).empty();
|
getString(file_->input_height).empty();
|
||||||
setEnabled(file_->check_aspectratio, !disable_aspectRatio);
|
setEnabled(file_->check_aspectratio, !disable_aspectRatio);
|
||||||
@ -399,7 +469,6 @@ void FormGraphics::update() {
|
|||||||
updateBB(igp.filename, igp.bb);
|
updateBB(igp.filename, igp.bb);
|
||||||
fl_set_button(bbox_->check_clip, igp.clip);
|
fl_set_button(bbox_->check_clip, igp.clip);
|
||||||
|
|
||||||
|
|
||||||
// the extra section
|
// the extra section
|
||||||
fl_set_input(extra_->input_rotate_angle,
|
fl_set_input(extra_->input_rotate_angle,
|
||||||
tostr(igp.rotateAngle).c_str());
|
tostr(igp.rotateAngle).c_str());
|
||||||
@ -432,7 +501,8 @@ void FormGraphics::updateBB(string const & filename, string const & bb_inset)
|
|||||||
// path, because the controller knows nothing about the doc-dir
|
// path, because the controller knows nothing about the doc-dir
|
||||||
controller().bbChanged = false;
|
controller().bbChanged = false;
|
||||||
if (bb_inset.empty()) {
|
if (bb_inset.empty()) {
|
||||||
lyxerr[Debug::GRAPHICS] << "FormGraphics::updateBB() [no BoundingBox]" << endl;
|
lyxerr[Debug::GRAPHICS]
|
||||||
|
<< "FormGraphics::updateBB() [no BoundingBox]" << endl;
|
||||||
string const bb = controller().readBB(filename);
|
string const bb = controller().readBB(filename);
|
||||||
if (!bb.empty()) {
|
if (!bb.empty()) {
|
||||||
// get the values from the file
|
// get the values from the file
|
||||||
@ -458,9 +528,9 @@ void FormGraphics::updateBB(string const & filename, string const & bb_inset)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// get the values from the inset
|
// get the values from the inset
|
||||||
lyxerr[Debug::GRAPHICS] << "FormGraphics::updateBB(): igp has BoundingBox"
|
lyxerr[Debug::GRAPHICS]
|
||||||
<< " ["<< bb_inset << "]"
|
<< "FormGraphics::updateBB(): igp has BoundingBox"
|
||||||
<< endl;
|
<< " ["<< bb_inset << "]" << endl;
|
||||||
controller().bbChanged = true;
|
controller().bbChanged = true;
|
||||||
|
|
||||||
LyXLength anyLength;
|
LyXLength anyLength;
|
||||||
@ -480,18 +550,6 @@ void FormGraphics::updateBB(string const & filename, string const & bb_inset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
bool isValid(FL_OBJECT * ob)
|
|
||||||
{
|
|
||||||
string const input = getString(ob);
|
|
||||||
return input.empty() || isValidLength(input) || isStrDbl(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace anon
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
// the file section
|
// the file section
|
||||||
@ -499,7 +557,8 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
// Get the filename from the dialog
|
// Get the filename from the dialog
|
||||||
string const in_name = getString(file_->input_filename);
|
string const in_name = getString(file_->input_filename);
|
||||||
string const out_name = controller().Browse(in_name);
|
string const out_name = controller().Browse(in_name);
|
||||||
lyxerr[Debug::GRAPHICS] << "[FormGraphics]out_name: " << out_name << endl;
|
lyxerr[Debug::GRAPHICS]
|
||||||
|
<< "[FormGraphics]out_name: " << out_name << endl;
|
||||||
if (out_name != in_name && !out_name.empty()) {
|
if (out_name != in_name && !out_name.empty()) {
|
||||||
fl_set_input(file_->input_filename, out_name.c_str());
|
fl_set_input(file_->input_filename, out_name.c_str());
|
||||||
}
|
}
|
||||||
@ -508,7 +567,8 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
updateBB(out_name, string());
|
updateBB(out_name, string());
|
||||||
}
|
}
|
||||||
} else if (ob == file_->input_width || ob == file_->input_height) {
|
} else if (ob == file_->input_width || ob == file_->input_height) {
|
||||||
// disable aspectratio button in case of scaling or one of width/height is empty
|
// disable aspectratio button in case of scaling or one of
|
||||||
|
// width/height is empty
|
||||||
bool const disable = fl_get_choice(file_->choice_width) == 1 ||
|
bool const disable = fl_get_choice(file_->choice_width) == 1 ||
|
||||||
getString(file_->input_width).empty() ||
|
getString(file_->input_width).empty() ||
|
||||||
getString(file_->input_height).empty();
|
getString(file_->input_height).empty();
|
||||||
@ -528,8 +588,10 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
fl_set_input_maxchars(file_->input_width, SIZE_MAXDIGITS);
|
fl_set_input_maxchars(file_->input_width, SIZE_MAXDIGITS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable aspectratio button in case of scaling or height input is empty
|
// disable aspectratio button in case of scaling or height
|
||||||
bool const disable_aspectratio = scaling || getString(file_->input_height).empty();
|
// input is empty
|
||||||
|
bool const disable_aspectratio =
|
||||||
|
scaling || getString(file_->input_height).empty();
|
||||||
setEnabled(file_->check_aspectratio, !disable_aspectratio);
|
setEnabled(file_->check_aspectratio, !disable_aspectratio);
|
||||||
// the bb section
|
// the bb section
|
||||||
} else if (!controller().bbChanged &&
|
} else if (!controller().bbChanged &&
|
||||||
@ -563,15 +625,5 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the input is valid
|
return ButtonPolicy::SMI_VALID;
|
||||||
bool const invalid = !isValid(file_->input_width) || !isValid(file_->input_height);
|
|
||||||
|
|
||||||
// deactivate OK / Apply buttons and spit out warnings if invalid
|
|
||||||
if (invalid) {
|
|
||||||
postWarning(_("Invalid Length in Output size!"));
|
|
||||||
return ButtonPolicy::SMI_INVALID;
|
|
||||||
} else {
|
|
||||||
clearMessage();
|
|
||||||
return ButtonPolicy::SMI_VALID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,14 @@ SnapGrid: 5
|
|||||||
|
|
||||||
=============== FORM ===============
|
=============== FORM ===============
|
||||||
Name: form_graphics
|
Name: form_graphics
|
||||||
Width: 400
|
Width: 395
|
||||||
Height: 325
|
Height: 300
|
||||||
Number of Objects: 7
|
Number of Objects: 6
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BOX
|
class: FL_BOX
|
||||||
type: FLAT_BOX
|
type: FLAT_BOX
|
||||||
box: 0 0 400 325
|
box: 0 0 395 300
|
||||||
boxtype: FL_FLAT_BOX
|
boxtype: FL_FLAT_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
@ -34,7 +34,7 @@ argument:
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_TABFOLDER
|
class: FL_TABFOLDER
|
||||||
type: TOP_TABFOLDER
|
type: TOP_TABFOLDER
|
||||||
box: 0 5 400 255
|
box: 0 5 395 260
|
||||||
boxtype: FL_FRAME_BOX
|
boxtype: FL_FRAME_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_TOP_LEFT
|
alignment: FL_ALIGN_TOP_LEFT
|
||||||
@ -52,7 +52,7 @@ argument:
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_BUTTON
|
class: FL_BUTTON
|
||||||
type: NORMAL_BUTTON
|
type: NORMAL_BUTTON
|
||||||
box: 5 295 100 25
|
box: 5 270 90 25
|
||||||
boxtype: FL_UP_BOX
|
boxtype: FL_UP_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
@ -70,7 +70,7 @@ argument: 0
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_BUTTON
|
class: FL_BUTTON
|
||||||
type: RETURN_BUTTON
|
type: RETURN_BUTTON
|
||||||
box: 115 295 90 25
|
box: 110 270 90 25
|
||||||
boxtype: FL_UP_BOX
|
boxtype: FL_UP_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
@ -88,7 +88,7 @@ argument: 0
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_BUTTON
|
class: FL_BUTTON
|
||||||
type: NORMAL_BUTTON
|
type: NORMAL_BUTTON
|
||||||
box: 305 295 90 25
|
box: 300 270 90 25
|
||||||
boxtype: FL_UP_BOX
|
boxtype: FL_UP_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
@ -106,7 +106,7 @@ argument: 0
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_BUTTON
|
class: FL_BUTTON
|
||||||
type: NORMAL_BUTTON
|
type: NORMAL_BUTTON
|
||||||
box: 210 295 90 25
|
box: 205 270 90 25
|
||||||
boxtype: FL_UP_BOX
|
boxtype: FL_UP_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
@ -121,34 +121,16 @@ name: button_apply
|
|||||||
callback: C_FormBaseApplyCB
|
callback: C_FormBaseApplyCB
|
||||||
argument: 0
|
argument: 0
|
||||||
|
|
||||||
--------------------
|
|
||||||
class: FL_TEXT
|
|
||||||
type: NORMAL_TEXT
|
|
||||||
box: 0 265 400 25
|
|
||||||
boxtype: FL_FLAT_BOX
|
|
||||||
colors: FL_COL1 FL_MCOL
|
|
||||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
|
||||||
style: FL_NORMAL_STYLE
|
|
||||||
size: FL_DEFAULT_SIZE
|
|
||||||
lcol: FL_BLACK
|
|
||||||
label:
|
|
||||||
shortcut:
|
|
||||||
resize: FL_RESIZE_NONE
|
|
||||||
gravity: FL_NoGravity FL_NoGravity
|
|
||||||
name: text_warning
|
|
||||||
callback: C_FormBaseInputCB
|
|
||||||
argument: 0
|
|
||||||
|
|
||||||
=============== FORM ===============
|
=============== FORM ===============
|
||||||
Name: form_graphics_file
|
Name: form_graphics_file
|
||||||
Width: 400
|
Width: 395
|
||||||
Height: 235
|
Height: 235
|
||||||
Number of Objects: 15
|
Number of Objects: 15
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BOX
|
class: FL_BOX
|
||||||
type: FLAT_BOX
|
type: FLAT_BOX
|
||||||
box: 0 0 400 235
|
box: 0 0 395 235
|
||||||
boxtype: FL_FLAT_BOX
|
boxtype: FL_FLAT_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
@ -166,7 +148,7 @@ argument:
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_LABELFRAME
|
class: FL_LABELFRAME
|
||||||
type: ENGRAVED_FRAME
|
type: ENGRAVED_FRAME
|
||||||
box: 5 125 390 105
|
box: 5 125 385 105
|
||||||
boxtype: FL_NO_BOX
|
boxtype: FL_NO_BOX
|
||||||
colors: FL_BLACK FL_COL1
|
colors: FL_BLACK FL_COL1
|
||||||
alignment: FL_ALIGN_TOP_LEFT
|
alignment: FL_ALIGN_TOP_LEFT
|
||||||
@ -184,7 +166,7 @@ argument:
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_INPUT
|
class: FL_INPUT
|
||||||
type: NORMAL_INPUT
|
type: NORMAL_INPUT
|
||||||
box: 60 10 230 25
|
box: 60 10 225 25
|
||||||
boxtype: FL_DOWN_BOX
|
boxtype: FL_DOWN_BOX
|
||||||
colors: FL_COL1 FL_MCOL
|
colors: FL_COL1 FL_MCOL
|
||||||
alignment: FL_ALIGN_LEFT
|
alignment: FL_ALIGN_LEFT
|
||||||
@ -202,7 +184,7 @@ argument: 0
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_BUTTON
|
class: FL_BUTTON
|
||||||
type: NORMAL_BUTTON
|
type: NORMAL_BUTTON
|
||||||
box: 295 10 100 25
|
box: 290 10 100 25
|
||||||
boxtype: FL_UP_BOX
|
boxtype: FL_UP_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
@ -220,7 +202,7 @@ argument: 0
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_LABELFRAME
|
class: FL_LABELFRAME
|
||||||
type: ENGRAVED_FRAME
|
type: ENGRAVED_FRAME
|
||||||
box: 5 55 390 60
|
box: 5 55 385 60
|
||||||
boxtype: FL_NO_BOX
|
boxtype: FL_NO_BOX
|
||||||
colors: FL_BLACK FL_COL1
|
colors: FL_BLACK FL_COL1
|
||||||
alignment: FL_ALIGN_TOP_LEFT
|
alignment: FL_ALIGN_TOP_LEFT
|
||||||
@ -245,7 +227,7 @@ alignment: FL_ALIGN_CENTER
|
|||||||
style: FL_NORMAL_STYLE
|
style: FL_NORMAL_STYLE
|
||||||
size: FL_NORMAL_SIZE
|
size: FL_NORMAL_SIZE
|
||||||
lcol: FL_BLACK
|
lcol: FL_BLACK
|
||||||
label: Draft mode|#m
|
label: Draft mode|#a
|
||||||
shortcut:
|
shortcut:
|
||||||
resize: FL_RESIZE_NONE
|
resize: FL_RESIZE_NONE
|
||||||
gravity: FL_East FL_East
|
gravity: FL_East FL_East
|
||||||
@ -353,7 +335,7 @@ alignment: FL_ALIGN_CENTER
|
|||||||
style: FL_NORMAL_STYLE
|
style: FL_NORMAL_STYLE
|
||||||
size: FL_NORMAL_SIZE
|
size: FL_NORMAL_SIZE
|
||||||
lcol: FL_BLACK
|
lcol: FL_BLACK
|
||||||
label: Maintain aspect ratio|#a
|
label: Maintain aspect ratio|#M
|
||||||
shortcut:
|
shortcut:
|
||||||
resize: FL_RESIZE_NONE
|
resize: FL_RESIZE_NONE
|
||||||
gravity: FL_West FL_West
|
gravity: FL_West FL_West
|
||||||
@ -400,7 +382,7 @@ argument:
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_CHOICE
|
class: FL_CHOICE
|
||||||
type: NORMAL_CHOICE
|
type: NORMAL_CHOICE
|
||||||
box: 270 70 115 25
|
box: 265 70 115 25
|
||||||
boxtype: FL_FRAME_BOX
|
boxtype: FL_FRAME_BOX
|
||||||
colors: FL_COL1 FL_BLACK
|
colors: FL_COL1 FL_BLACK
|
||||||
alignment: FL_ALIGN_LEFT
|
alignment: FL_ALIGN_LEFT
|
||||||
@ -417,14 +399,14 @@ argument: 0
|
|||||||
|
|
||||||
=============== FORM ===============
|
=============== FORM ===============
|
||||||
Name: form_graphics_bbox
|
Name: form_graphics_bbox
|
||||||
Width: 400
|
Width: 395
|
||||||
Height: 235
|
Height: 235
|
||||||
Number of Objects: 10
|
Number of Objects: 10
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BOX
|
class: FL_BOX
|
||||||
type: FLAT_BOX
|
type: FLAT_BOX
|
||||||
box: 0 0 400 235
|
box: 0 0 395 235
|
||||||
boxtype: FL_FLAT_BOX
|
boxtype: FL_FLAT_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
@ -525,7 +507,7 @@ label: X
|
|||||||
shortcut:
|
shortcut:
|
||||||
resize: FL_RESIZE_NONE
|
resize: FL_RESIZE_NONE
|
||||||
gravity: FL_North FL_North
|
gravity: FL_North FL_North
|
||||||
name:
|
name: text_X
|
||||||
callback:
|
callback:
|
||||||
argument:
|
argument:
|
||||||
|
|
||||||
@ -603,14 +585,14 @@ argument: 0
|
|||||||
|
|
||||||
=============== FORM ===============
|
=============== FORM ===============
|
||||||
Name: form_graphics_extra
|
Name: form_graphics_extra
|
||||||
Width: 400
|
Width: 395
|
||||||
Height: 235
|
Height: 235
|
||||||
Number of Objects: 8
|
Number of Objects: 8
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BOX
|
class: FL_BOX
|
||||||
type: FLAT_BOX
|
type: FLAT_BOX
|
||||||
box: 0 0 400 235
|
box: 0 0 395 235
|
||||||
boxtype: FL_FLAT_BOX
|
boxtype: FL_FLAT_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
@ -628,7 +610,7 @@ argument:
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_LABELFRAME
|
class: FL_LABELFRAME
|
||||||
type: ENGRAVED_FRAME
|
type: ENGRAVED_FRAME
|
||||||
box: 5 20 390 55
|
box: 5 20 385 55
|
||||||
boxtype: FL_NO_BOX
|
boxtype: FL_NO_BOX
|
||||||
colors: FL_BLACK FL_COL1
|
colors: FL_BLACK FL_COL1
|
||||||
alignment: FL_ALIGN_TOP_LEFT
|
alignment: FL_ALIGN_TOP_LEFT
|
||||||
@ -646,7 +628,7 @@ argument:
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_INPUT
|
class: FL_INPUT
|
||||||
type: NORMAL_INPUT
|
type: NORMAL_INPUT
|
||||||
box: 115 165 275 25
|
box: 115 165 270 25
|
||||||
boxtype: FL_DOWN_BOX
|
boxtype: FL_DOWN_BOX
|
||||||
colors: FL_COL1 FL_MCOL
|
colors: FL_COL1 FL_MCOL
|
||||||
alignment: FL_ALIGN_LEFT
|
alignment: FL_ALIGN_LEFT
|
||||||
@ -682,7 +664,7 @@ argument:
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_CHOICE
|
class: FL_CHOICE
|
||||||
type: NORMAL_CHOICE
|
type: NORMAL_CHOICE
|
||||||
box: 250 35 135 25
|
box: 245 35 135 25
|
||||||
boxtype: FL_FRAME_BOX
|
boxtype: FL_FRAME_BOX
|
||||||
colors: FL_COL1 FL_BLACK
|
colors: FL_COL1 FL_BLACK
|
||||||
alignment: FL_ALIGN_LEFT
|
alignment: FL_ALIGN_LEFT
|
||||||
@ -736,7 +718,7 @@ argument: 0
|
|||||||
--------------------
|
--------------------
|
||||||
class: FL_INPUT
|
class: FL_INPUT
|
||||||
type: NORMAL_INPUT
|
type: NORMAL_INPUT
|
||||||
box: 115 105 275 25
|
box: 115 105 270 25
|
||||||
boxtype: FL_DOWN_BOX
|
boxtype: FL_DOWN_BOX
|
||||||
colors: FL_COL1 FL_MCOL
|
colors: FL_COL1 FL_MCOL
|
||||||
alignment: FL_ALIGN_LEFT
|
alignment: FL_ALIGN_LEFT
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2002-10-24 Rob Lahaye <lahaye@snu.ac.kr>
|
||||||
|
|
||||||
|
* insetgraphicsParams.h (scale): is now a float, not an unsigned int.
|
||||||
|
|
||||||
|
* insetgraphicsParams.C (init, Write): associated changes
|
||||||
|
* insetgraphics.C (createLatexOptions): use lyx::float_equal with
|
||||||
|
InsetGraphicsParams::scale.
|
||||||
|
|
||||||
2002-10-21 John Levon <levon@movementarian.org>
|
2002-10-21 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
* inset.h: remove unused DISPATCH_RESULT
|
* inset.h: remove unused DISPATCH_RESULT
|
||||||
|
@ -85,6 +85,7 @@ TODO
|
|||||||
#include "support/LAssert.h"
|
#include "support/LAssert.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "support/lyxalgo.h" // lyx::count
|
#include "support/lyxalgo.h" // lyx::count
|
||||||
|
#include "support/lyxlib.h" // float_equal
|
||||||
#include "support/path.h"
|
#include "support/path.h"
|
||||||
#include "support/systemcall.h"
|
#include "support/systemcall.h"
|
||||||
#include "support/os.h"
|
#include "support/os.h"
|
||||||
@ -469,9 +470,10 @@ string const InsetGraphics::createLatexOptions() const
|
|||||||
if (params().clip)
|
if (params().clip)
|
||||||
options << " clip,\n";
|
options << " clip,\n";
|
||||||
|
|
||||||
if (params().scale) {
|
if (!lyx::float_equal(params().scale, 0.0, 0.05)) {
|
||||||
if (params().scale != 100)
|
if (!lyx::float_equal(params().scale, 100.0, 0.05))
|
||||||
options << " scale=" << params().scale / 100.0 << ",\n";
|
options << " scale=" << params().scale / 100.0
|
||||||
|
<< ",\n";
|
||||||
} else {
|
} else {
|
||||||
if (!params().width.zero())
|
if (!params().width.zero())
|
||||||
options << " width=" << params().width.asLatexString() << ",\n";
|
options << " width=" << params().width.asLatexString() << ",\n";
|
||||||
|
@ -58,7 +58,7 @@ void InsetGraphicsParams::init()
|
|||||||
filename.erase();
|
filename.erase();
|
||||||
lyxscale = 100; // lyx scaling in percentage
|
lyxscale = 100; // lyx scaling in percentage
|
||||||
display = grfx::DefaultDisplay; // display mode; see preferences
|
display = grfx::DefaultDisplay; // display mode; see preferences
|
||||||
scale = 100; // output scaling in percentage
|
scale = 100.0; // output scaling in percentage
|
||||||
width = LyXLength();
|
width = LyXLength();
|
||||||
height = LyXLength();
|
height = LyXLength();
|
||||||
keepAspectRatio = false; // for LaTeX output
|
keepAspectRatio = false; // for LaTeX output
|
||||||
@ -143,7 +143,7 @@ void InsetGraphicsParams::Write(ostream & os) const
|
|||||||
if (display != grfx::DefaultDisplay)
|
if (display != grfx::DefaultDisplay)
|
||||||
os << "\tdisplay " << grfx::displayTranslator.find(display) << '\n';
|
os << "\tdisplay " << grfx::displayTranslator.find(display) << '\n';
|
||||||
if (scale) {
|
if (scale) {
|
||||||
if (scale != 100)
|
if (!lyx::float_equal(scale, 100.0, 0.05))
|
||||||
os << "\tscale " << scale << '\n';
|
os << "\tscale " << scale << '\n';
|
||||||
} else {
|
} else {
|
||||||
if (!width.zero())
|
if (!width.zero())
|
||||||
@ -191,11 +191,11 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token)
|
|||||||
display = grfx::displayTranslator.find(type);
|
display = grfx::displayTranslator.find(type);
|
||||||
} else if (token == "scale") {
|
} else if (token == "scale") {
|
||||||
lex.next();
|
lex.next();
|
||||||
scale = lex.getInteger();
|
scale = lex.getFloat();
|
||||||
} else if (token == "width") {
|
} else if (token == "width") {
|
||||||
lex.next();
|
lex.next();
|
||||||
width = LyXLength(lex.getString());
|
width = LyXLength(lex.getString());
|
||||||
scale = 0;
|
scale = 0.0;
|
||||||
} else if (token == "height") {
|
} else if (token == "height") {
|
||||||
lex.next();
|
lex.next();
|
||||||
height = LyXLength(lex.getString());
|
height = LyXLength(lex.getString());
|
||||||
@ -228,11 +228,14 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token)
|
|||||||
special = lex.getString();
|
special = lex.getString();
|
||||||
|
|
||||||
// catch and ignore following two old-format tokens and their arguments.
|
// catch and ignore following two old-format tokens and their arguments.
|
||||||
// e.g. "size_kind scale" clashes with the setting of the "scale" keyword.
|
// e.g. "size_kind scale" clashes with the setting of the
|
||||||
|
// "scale <value>" keyword.
|
||||||
} else if (token == "size_kind" || token == "lyxsize_kind") {
|
} else if (token == "size_kind" || token == "lyxsize_kind") {
|
||||||
lex.next();
|
lex.next();
|
||||||
lex.getString();
|
lex.getString();
|
||||||
} else { // If it's none of the above, it's not ours.
|
|
||||||
|
} else {
|
||||||
|
// If it's none of the above, it's not ours.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -37,7 +37,7 @@ struct InsetGraphicsParams
|
|||||||
/// How to display the image inside LyX
|
/// How to display the image inside LyX
|
||||||
grfx::DisplayType display;
|
grfx::DisplayType display;
|
||||||
/// Scaling for output (LaTeX)
|
/// Scaling for output (LaTeX)
|
||||||
unsigned int scale;
|
float scale;
|
||||||
/// sizes for output (LaTeX)
|
/// sizes for output (LaTeX)
|
||||||
LyXLength width;
|
LyXLength width;
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user