+2002-02-10 Rob Lahaye <lahaye@users.sourceforge.net>
+ * forms/form_external.fd:
+ * form_external.C: change color2 of a few buttons into the
+ proper grey color.
+
+2002-02-08 Herbert Voss <voss@lyx.org>
+
+ * forms/form_graphics.fd:
+ * FormGraphics.C:
+ * form_graphics.[Ch]: Adding buttons for unzip-Option,
+ getValues from LyX/LaTeXfolder
+
+2002-02-08 Rob Lahaye <lahaye@users.sourceforge.net>
+
+ * forms/form_graphics.fd:
+ * FormGraphics.C:
+ * form_graphics.[Ch]: simplify the bounding box folder
+ of the Graphic GUI
+
2002-02-08 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* Menubar_pimpl.C (create_submenu): work around an xforms bug (?)
int const HEIGHT_MAXDIGITS = 10;
int const ROTATE_MAXCHARS = 4;
int const FILENAME_MAXCHARS = 1024;
+string defaultUnit = "cm";
} // namespace anon
bc().addReadOnly(file_->check_rotate);
bc().addReadOnly(file_->button_clip);
bc().addReadOnly(file_->button_draft);
+ bc().addReadOnly(file_->button_nounzip);
// the lyxview section
lyxview_.reset(build_lyxview());
fl_set_input_return (bbox_->input_bb_y1, FL_RETURN_CHANGED);
string const bb_units = "pt|cm|in";
- fl_addto_choice(bbox_->choice_bb_x0, bb_units.c_str());
- fl_addto_choice(bbox_->choice_bb_y0, bb_units.c_str());
- fl_addto_choice(bbox_->choice_bb_x1, bb_units.c_str());
- fl_addto_choice(bbox_->choice_bb_y1, bb_units.c_str());
+ fl_addto_choice(bbox_->choice_bb_units, bb_units.c_str());
bc().addReadOnly(bbox_->button_getBB);
// the rotate section
igp.rotateOrigin = string();
igp.draft = fl_get_button(file_->button_draft);
igp.clip = fl_get_button(file_->button_clip);
+ igp.noUnzip = fl_get_button(file_->button_nounzip);
// the lyxview section
if (fl_get_button(lyxview_->radio_pref))
bb = "0 ";
else
bb = getLengthFromWidgets(bbox_->input_bb_x0,
- bbox_->choice_bb_x0)+" ";
+ bbox_->choice_bb_units)+" ";
if (getStringFromInput(bbox_->input_bb_y0).empty())
bb += "0 ";
else
bb += (getLengthFromWidgets(bbox_->input_bb_y0,
- bbox_->choice_bb_y0)+" ");
+ bbox_->choice_bb_units)+" ");
if (getStringFromInput(bbox_->input_bb_x1).empty())
bb += "0 ";
else
bb += (getLengthFromWidgets(bbox_->input_bb_x1,
- bbox_->choice_bb_x1)+" ");
+ bbox_->choice_bb_units)+" ");
if (getStringFromInput(bbox_->input_bb_y1).empty())
bb += "0 ";
else
bb += (getLengthFromWidgets(bbox_->input_bb_y1,
- bbox_->choice_bb_y1)+" ");
+ bbox_->choice_bb_units)+" ");
igp.bb = bb;
}
void FormGraphics::update() {
- string unit = "cm";
if (lyxrc.default_papersize < 3)
- unit = "in";
- string const defaultUnit = string(unit);
+ defaultUnit = string("in");
// Update dialog with details from inset
InsetGraphicsParams & igp = controller().params();
fl_get_button(file_->check_rotate));
fl_set_button(file_->button_draft, igp.draft);
fl_set_button(file_->button_clip, igp.clip);
+ fl_set_button(file_->button_nounzip, igp.noUnzip);
// the lyxview section
switch (igp.display) {
LyXLength anyLength;
anyLength = LyXLength(token(igp.bb,' ',0));
updateWidgetsFromLength(bbox_->input_bb_x0,
- bbox_->choice_bb_x0,anyLength,"pt");
+ bbox_->choice_bb_units,anyLength,"pt");
anyLength = LyXLength(token(igp.bb,' ',1));
updateWidgetsFromLength(bbox_->input_bb_y0,
- bbox_->choice_bb_y0,anyLength,"pt");
+ bbox_->choice_bb_units,anyLength,"pt");
anyLength = LyXLength(token(igp.bb,' ',2));
updateWidgetsFromLength(bbox_->input_bb_x1,
- bbox_->choice_bb_x1,anyLength,"pt");
+ bbox_->choice_bb_units,anyLength,"pt");
anyLength = LyXLength(token(igp.bb,' ',3));
updateWidgetsFromLength(bbox_->input_bb_y1,
- bbox_->choice_bb_y1,anyLength,"pt");
+ bbox_->choice_bb_units,anyLength,"pt");
}
// the special section
setEnabled(lyxview_->input_lyxheight, 0);
setEnabled(lyxview_->choice_width_lyxheight, 0);
setEnabled(lyxview_->input_lyxscale, 1);
+ } else if (ob == lyxview_->button_latex_values) {
+ LyXLength dummy = LyXLength(getLengthFromWidgets(size_->input_width,
+ size_->choice_width_units));
+ updateWidgetsFromLength(lyxview_->input_lyxwidth,
+ lyxview_->choice_width_lyxwidth, dummy, defaultUnit);
+ dummy = LyXLength(getLengthFromWidgets(size_->input_height,
+ size_->choice_width_units));
+ updateWidgetsFromLength(lyxview_->input_lyxheight,
+ lyxview_->choice_width_lyxheight, dummy, defaultUnit);
+ string const scale = fl_get_input(size_->input_scale);
+ fl_set_input(lyxview_->input_lyxscale, scale.c_str());
// the bb section
} else if (!controller().bbChanged &&
- (ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_y0 ||
- ob == bbox_->input_bb_x1 || ob == bbox_->input_bb_y1 ||
- ob == bbox_->choice_bb_x0 || ob == bbox_->choice_bb_y0 ||
- ob == bbox_->choice_bb_x1 || ob == bbox_->choice_bb_y1)) {
+ (ob == bbox_->choice_bb_units ||
+ ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_y0 ||
+ ob == bbox_->input_bb_x1 || ob == bbox_->input_bb_y1)) {
controller().bbChanged = true;
} else if (ob == bbox_->button_getBB) {
string const filename = getStringFromInput(file_->input_filename);
string const fileWithAbsPath = MakeAbsPath(filename, OnlyPath(filename));
string bb = controller().readBB(fileWithAbsPath);
lyxerr << "getBB::BoundingBox = " << bb << "\n";
- if (!bb.empty()) {
- updateWidgetsFromLengthString(bbox_->input_bb_x0,
- bbox_->choice_bb_x0,
- token(bb,' ',0), "pt");
- updateWidgetsFromLengthString(bbox_->input_bb_y0,
- bbox_->choice_bb_y0,
- token(bb,' ',1), "pt");
- updateWidgetsFromLengthString(bbox_->input_bb_x1,
- bbox_->choice_bb_x1,
- token(bb,' ',2), "pt");
- updateWidgetsFromLengthString(bbox_->input_bb_y1,
- bbox_->choice_bb_y1,
- token(bb,' ',3), "pt");
+ if (!bb.empty()) {
+ updateWidgetsFromLengthString(bbox_->input_bb_x0,
+ bbox_->choice_bb_units,
+ token(bb,' ',0), "pt");
+ updateWidgetsFromLengthString(bbox_->input_bb_y0,
+ bbox_->choice_bb_units,
+ token(bb,' ',1), "pt");
+ updateWidgetsFromLengthString(bbox_->input_bb_x1,
+ bbox_->choice_bb_units,
+ token(bb,' ',2), "pt");
+ updateWidgetsFromLengthString(bbox_->input_bb_y1,
+ bbox_->choice_bb_units,
+ token(bb,' ',3), "pt");
}
controller().bbChanged = false;
}
setEnabled(size_->choice_height_units, 0);
setEnabled(size_->check_aspectratio, 0);
setEnabled(size_->input_scale, 1);
+ } else if (ob == size_->button_lyx_values) {
+ LyXLength dummy = LyXLength(getLengthFromWidgets(
+ lyxview_->input_lyxwidth, lyxview_->choice_width_lyxwidth));
+ updateWidgetsFromLength(size_->input_width,
+ size_->choice_width_units, dummy, defaultUnit);
+ dummy = LyXLength(getLengthFromWidgets(lyxview_->input_lyxheight,
+ lyxview_->choice_width_lyxheight));
+ updateWidgetsFromLength(size_->input_height,
+ size_->choice_height_units, dummy, defaultUnit);
+ string const scale = fl_get_input(lyxview_->input_lyxscale);
+ fl_set_input(size_->input_scale, scale.c_str());
}
// check if the input is valid
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_boxtype(obj, FL_FRAME_BOX);
+ fl_set_object_color(obj, FL_COL1, FL_RIGHT_BCOL);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->button_edit = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 50, 110, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
- fl_set_object_color(obj, FL_COL1, FL_BLACK);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->button_view = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 90, 110, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
- fl_set_object_color(obj, FL_COL1, FL_BLACK);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->button_update = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 130, 110, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
- fl_set_object_color(obj, FL_COL1, FL_BLACK);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 255, 270, 90, 30, _("OK"));
- fl_set_object_color(obj, FL_COL1, FL_BLACK);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseOKCB, 0);
fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 355, 270, 90, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
- fl_set_object_color(obj, FL_COL1, FL_BLACK);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseApplyCB, 0);
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
- char const * const dummy = N_("Title:|#T");
+ char const * const dummy = N_("Title|#T");
fdui->input_subcaption = obj = fl_add_input(FL_NORMAL_INPUT, 190, 65, 280, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
{
- char const * const dummy = N_("Angle:|#n");
+ char const * const dummy = N_("Angle|#n");
fdui->input_rotate_angle = obj = fl_add_input(FL_INT_INPUT, 190, 125, 55, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
{
- char const * const dummy = N_("Origin:|#O");
+ char const * const dummy = N_("Origin|#O");
fdui->choice_origin = obj = fl_add_choice(FL_NORMAL_CHOICE, 350, 125, 118, 28, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
{
char const * const dummy = N_("clip to bounding box|#b");
- fdui->button_clip = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 145, 190, 30, 30, idex(_(dummy)));
+ fdui->button_clip = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 140, 190, 30, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ {
+ char const * const dummy = N_("don't unzip, when \nexporting to LaTeX|#u");
+ fdui->button_nounzip = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 315, 190, 30, 30, idex(_(dummy)));
+ fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+ }
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fl_end_form();
fdui->form->fdui = fdui;
fl_end_group();
{
- char const * const dummy = N_("Value:|#V");
+ char const * const dummy = N_("Value|#V");
fdui->input_scale = obj = fl_add_input(FL_NORMAL_INPUT, 325, 75, 85, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
{
- char const * const dummy = N_("Width:|#W");
+ char const * const dummy = N_("Width|#W");
fdui->input_width = obj = fl_add_input(FL_NORMAL_INPUT, 325, 140, 85, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
- char const * const dummy = N_("Height:|#g");
+ char const * const dummy = N_("Height|#g");
fdui->input_height = obj = fl_add_input(FL_NORMAL_INPUT, 325, 175, 85, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 15, 60, 470, 65, "");
+ {
+ char const * const dummy = N_("Get LyX size|#x");
+ fdui->button_lyx_values = obj = fl_add_button(FL_NORMAL_BUTTON, 360, 20, 115, 30, idex(_(dummy)));
+ fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+ }
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ obj = fl_add_frame(FL_ENGRAVED_FRAME, 340, 10, 5, 50, "");
fl_end_form();
fdui->form->fdui = fdui;
fdui->form->u_vdata = this;
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 505, 235, "");
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 20, 25, 455, 195, "");
+ obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 15, 10, 475, 205, _("Corner coordinates (X, Y)"));
+ fl_set_object_boxtype(obj, FL_UP_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- obj = fl_add_text(FL_NORMAL_TEXT, 135, 35, 35, 25, _("X"));
+ obj = fl_add_text(FL_NORMAL_TEXT, 195, 110, 30, 25, _(", "));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
- obj = fl_add_text(FL_NORMAL_TEXT, 360, 35, 30, 25, _("Y"));
+ obj = fl_add_text(FL_NORMAL_TEXT, 195, 55, 30, 25, _(", "));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
{
- char const * const dummy = N_("Left Bottom:|#L");
- fdui->input_bb_x0 = obj = fl_add_input(FL_NORMAL_INPUT, 135, 60, 50, 30, idex(_(dummy)));
- fl_set_button_shortcut(obj, scex(_(dummy)), 1);
- }
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- fdui->choice_bb_x0 = obj = fl_add_choice(FL_NORMAL_CHOICE, 190, 60, 50, 30, "");
- fl_set_object_boxtype(obj, FL_FRAME_BOX);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- {
- char const * const dummy = N_("Right Top:|#R");
- fdui->input_bb_x1 = obj = fl_add_input(FL_NORMAL_INPUT, 135, 100, 50, 30, idex(_(dummy)));
+ char const * const dummy = N_("Top right ( |#T");
+ fdui->input_bb_x1 = obj = fl_add_input(FL_NORMAL_INPUT, 150, 45, 50, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- fdui->choice_bb_x1 = obj = fl_add_choice(FL_NORMAL_CHOICE, 190, 100, 50, 30, "");
- fl_set_object_boxtype(obj, FL_FRAME_BOX);
+ fdui->input_bb_y1 = obj = fl_add_input(FL_NORMAL_INPUT, 220, 45, 50, 30, _(" )"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
- char const * const dummy = N_("Left Bottom:|#f");
- fdui->input_bb_y0 = obj = fl_add_input(FL_NORMAL_INPUT, 360, 60, 50, 30, idex(_(dummy)));
+ char const * const dummy = N_("Bottom left ( |#B");
+ fdui->input_bb_x0 = obj = fl_add_input(FL_NORMAL_INPUT, 150, 95, 50, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- fdui->choice_bb_y0 = obj = fl_add_choice(FL_NORMAL_CHOICE, 415, 60, 45, 30, "");
- fl_set_object_boxtype(obj, FL_FRAME_BOX);
+ fdui->input_bb_y0 = obj = fl_add_input(FL_NORMAL_INPUT, 220, 95, 50, 30, _(" )"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
- char const * const dummy = N_("Right Top:|#T");
- fdui->input_bb_y1 = obj = fl_add_input(FL_NORMAL_INPUT, 360, 100, 50, 30, idex(_(dummy)));
+ char const * const dummy = N_("Units|#U");
+ fdui->choice_bb_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 370, 70, 45, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- fdui->choice_bb_y1 = obj = fl_add_choice(FL_NORMAL_CHOICE, 415, 100, 45, 30, "");
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
- char const * const dummy = N_("Get bounding box from file|#G");
- fdui->button_getBB = obj = fl_add_button(FL_NORMAL_BUTTON, 135, 160, 220, 30, idex(_(dummy)));
+ char const * const dummy = N_("Get values from file|#G");
+ fdui->button_getBB = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 160, 165, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 15, 15, 455, 70, _("Special Options"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
{
- char const * const dummy = N_("LaTeX Options:|#L");
+ char const * const dummy = N_("LaTeX Options|#L");
fdui->input_special = obj = fl_add_input(FL_NORMAL_INPUT, 190, 40, 265, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
{
- char const * const dummy = N_("Value:|#V");
+ char const * const dummy = N_("Value|#V");
fdui->input_lyxscale = obj = fl_add_input(FL_NORMAL_INPUT, 350, 75, 70, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 150, 10, 340, 50, _("Screen Size"));
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
{
- char const * const dummy = N_("Width:|#w");
+ char const * const dummy = N_("Width|#w");
fdui->input_lyxwidth = obj = fl_add_input(FL_NORMAL_INPUT, 350, 130, 70, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
- char const * const dummy = N_("Height:|#h");
+ char const * const dummy = N_("Height|#h");
fdui->input_lyxheight = obj = fl_add_input(FL_NORMAL_INPUT, 350, 170, 70, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
obj = fl_add_text(FL_NORMAL_TEXT, 30, 45, 115, 25, _("(from Preferences)"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ {
+ char const * const dummy = N_("Get LaTeX size|#x");
+ fdui->button_latex_values = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 20, 115, 30, idex(_(dummy)));
+ fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+ }
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ obj = fl_add_frame(FL_ENGRAVED_FRAME, 320, 10, 5, 50, "");
fl_end_form();
fdui->form->fdui = fdui;
FL_OBJECT *button_clip;
FL_OBJECT *button_draft;
FL_OBJECT *check_rotate;
+ FL_OBJECT *button_nounzip;
};
struct FD_form_size {
~FD_form_size();
FL_OBJECT *input_height;
FL_OBJECT *choice_height_units;
FL_OBJECT *check_aspectratio;
+ FL_OBJECT *button_lyx_values;
};
struct FD_form_bbox {
~FD_form_bbox();
FL_FORM *form;
- FL_OBJECT *input_bb_x0;
- FL_OBJECT *choice_bb_x0;
FL_OBJECT *input_bb_x1;
- FL_OBJECT *choice_bb_x1;
- FL_OBJECT *input_bb_y0;
- FL_OBJECT *choice_bb_y0;
FL_OBJECT *input_bb_y1;
- FL_OBJECT *choice_bb_y1;
+ FL_OBJECT *input_bb_x0;
+ FL_OBJECT *input_bb_y0;
+ FL_OBJECT *choice_bb_units;
FL_OBJECT *button_getBB;
};
struct FD_form_special {
FL_OBJECT *choice_width_lyxwidth;
FL_OBJECT *input_lyxheight;
FL_OBJECT *choice_width_lyxheight;
+ FL_OBJECT *button_latex_values;
};
#endif /* FD_form_graphics_h_ */
type: NORMAL_CHOICE
box: 130 10 300 30
boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
+colors: FL_COL1 FL_RIGHT_BCOL
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
type: NORMAL_BUTTON
box: 435 50 110 30
boxtype: FL_UP_BOX
-colors: FL_COL1 FL_BLACK
+colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
type: NORMAL_BUTTON
box: 435 90 110 30
boxtype: FL_UP_BOX
-colors: FL_COL1 FL_BLACK
+colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
type: NORMAL_BUTTON
box: 435 130 110 30
boxtype: FL_UP_BOX
-colors: FL_COL1 FL_BLACK
+colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
type: RETURN_BUTTON
box: 255 270 90 30
boxtype: FL_UP_BOX
-colors: FL_COL1 FL_BLACK
+colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
type: NORMAL_BUTTON
box: 355 270 90 30
boxtype: FL_UP_BOX
-colors: FL_COL1 FL_BLACK
+colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
Name: form_file
Width: 505
Height: 235
-Number of Objects: 14
+Number of Objects: 15
--------------------
class: FL_BOX
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Title:|#T
+label: Title|#T
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Angle:|#n
+label: Angle|#n
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Origin:|#O
+label: Origin|#O
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 145 190 30 30
+box: 140 190 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_RIGHT
callback: C_FormBaseInputCB
argument: 0
+--------------------
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 315 190 30 30
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_RIGHT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: don't unzip, when \nexporting to LaTeX|#u
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_nounzip
+callback: C_FormBaseInputCB
+argument: 0
+
=============== FORM ===============
Name: form_size
Width: 505
Height: 235
-Number of Objects: 15
+Number of Objects: 17
--------------------
class: FL_BOX
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Value:|#V
+label: Value|#V
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Width:|#W
+label: Width|#W
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Height:|#g
+label: Height|#g
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
callback:
argument:
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 360 20 115 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Get LyX size|#x
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_lyx_values
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_FRAME
+type: ENGRAVED_FRAME
+box: 340 10 5 50
+boxtype: FL_NO_BOX
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label:
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name:
+callback:
+argument:
+
=============== FORM ===============
Name: form_bbox
Width: 505
Height: 235
-Number of Objects: 13
+Number of Objects: 10
--------------------
class: FL_BOX
--------------------
class: FL_LABELFRAME
type: ENGRAVED_FRAME
-box: 20 25 455 195
-boxtype: FL_NO_BOX
+box: 15 10 475 205
+boxtype: FL_UP_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label:
+label: Corner coordinates (X, Y)
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
--------------------
class: FL_TEXT
type: NORMAL_TEXT
-box: 135 35 35 25
+box: 195 110 30 25
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
+alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_BOLD_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: X
+label: ,
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
--------------------
class: FL_TEXT
type: NORMAL_TEXT
-box: 360 35 30 25
+box: 195 55 30 25
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
+alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_BOLD_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Y
+label: ,
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 135 60 50 30
+box: 150 45 50 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Left Bottom:|#L
+label: Top right ( |#T
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: input_bb_x0
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 190 60 50 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: choice_bb_x0
+name: input_bb_x1
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 135 100 50 30
+box: 220 45 50 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Right Top:|#R
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_bb_x1
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 190 100 50 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
+alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label:
+label: )
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: choice_bb_x1
+name: input_bb_y1
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 360 60 50 30
+box: 150 95 50 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Left Bottom:|#f
+label: Bottom left ( |#B
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: input_bb_y0
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 415 60 45 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: choice_bb_y0
+name: input_bb_x0
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 360 100 50 30
+box: 220 95 50 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
+alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Right Top:|#T
+label: )
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: input_bb_y1
+name: input_bb_y0
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 415 100 45 30
+box: 370 70 45 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label:
+label: Units|#U
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: choice_bb_y1
+name: choice_bb_units
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
-box: 135 160 220 30
+box: 110 160 165 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Get bounding box from file|#G
+label: Get values from file|#G
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: LaTeX Options:|#L
+label: LaTeX Options|#L
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
Name: form_lyxview
Width: 505
Height: 235
-Number of Objects: 24
+Number of Objects: 26
--------------------
class: FL_BOX
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Value:|#V
+label: Value|#V
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Width:|#w
+label: Width|#w
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Height:|#h
+label: Height|#h
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
callback:
argument:
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 350 20 115 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Get LaTeX size|#x
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_latex_values
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_FRAME
+type: ENGRAVED_FRAME
+box: 320 10 5 50
+boxtype: FL_NO_BOX
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label:
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name:
+callback:
+argument:
+
==============================
--------------------
+2002-02-08 Herbert Voss <voss@lyx.org>
+
+ * insetgraphic.C:
+ * insetgraphicsParams.[Ch]: adding new Option noUnzip to
+ prevent LyX from unzipping when this should be handled
+ by latex vis the graphic.cfg.
+ clean up the code
+
2002-02-08 Herbert Voss <voss@lyx.org>
* insetgraphic.C: prepareFile(): fix bug when file doesn't
#include "insets/insetgraphicsParams.h"
#include "graphics/GraphicsCache.h"
#include "graphics/GraphicsCacheItem.h"
+#include "graphics/GraphicsImage.h"
#include "frontends/Dialogs.h"
#include "frontends/Alert.h"
#include "buffer.h"
#include "BufferView.h"
#include "converter.h"
-#include "frontends/support/LyXImage.h"
#include "Painter.h"
#include "lyx_gui_misc.h"
#include "support/FileInfo.h"
}
-// Initialize only those variables that do not have a constructor.
InsetGraphics::InsetGraphics()
- : cacheHandle(0), imageLoaded(false)
{}
InsetGraphics::InsetGraphics(InsetGraphics const & ig, bool same_id)
- : Inset(), SigC::Object()
- , cacheHandle(ig.cacheHandle)
- , imageLoaded(ig.imageLoaded)
{
setParams(ig.getParams());
if (same_id)
InsetGraphics::~InsetGraphics()
{
+ grfx::GCache & gc = grfx::GCache::get();
+ gc.remove(*this);
+
// Emits the hide signal to the dialog connected (if any)
hideDialog();
}
string const InsetGraphics::statusMessage() const
{
string msg;
- if (cacheHandle.get()) {
- switch (cacheHandle->getImageStatus()) {
- case GraphicsCacheItem::UnknownError:
- msg = _("Unknown Error");
- break;
- case GraphicsCacheItem::Loading:
- msg = _("Loading...");
- break;
- case GraphicsCacheItem::ErrorReading:
- msg = _("Error reading");
- break;
- case GraphicsCacheItem::Converting:
- msg = _("Converting Image");
- break;
- case GraphicsCacheItem::ErrorConverting:
- msg = _("Error converting");
- break;
- case GraphicsCacheItem::Loaded:
- // No message to write.
- break;
- }
+ grfx::GCache const & gc = grfx::GCache::get();
+ grfx::ImageStatus const status = gc.status(*this);
+
+ switch (status) {
+ case grfx::WaitingToLoad:
+ msg = _("Waiting for draw request to start loading...");
+ break;
+ case grfx::Loading:
+ msg = _("Loading...");
+ break;
+ case grfx::Converting:
+ msg = _("Converting to loadable format...");
+ break;
+ case grfx::ScalingEtc:
+ msg = _("Loaded. Scaling etc...");
+ break;
+ case grfx::ErrorLoading:
+ msg = _("Error loading");
+ break;
+ case grfx::ErrorConverting:
+ msg = _("Error converting to loadable format");
+ break;
+ case grfx::ErrorScalingEtc:
+ msg = _("Error scaling etc");
+ break;
+ case grfx::ErrorUnknown:
+ msg = _("No image associated with this inset is in the cache!");
+ break;
+ case grfx::Loaded:
+ msg = _("Loaded");
+ break;
}
+
return msg;
}
int InsetGraphics::ascent(BufferView *, LyXFont const &) const
{
- LyXImage * pixmap = 0;
- if (cacheHandle.get() && (pixmap = cacheHandle->getImage()))
- return pixmap->getHeight();
+ grfx::GCache const & gc = grfx::GCache::get();
+ grfx::ImagePtr const image_ptr = gc.image(*this);
+
+ if (image_ptr.get() && image_ptr->getPixmap())
+ return image_ptr->getHeight();
else
return 50;
}
int InsetGraphics::width(BufferView *, LyXFont const & font) const
{
- LyXImage * pixmap = 0;
-
- if (cacheHandle.get() && (pixmap = cacheHandle->getImage()))
- return pixmap->getWidth();
+ grfx::GCache const & gc = grfx::GCache::get();
+ grfx::ImagePtr const image_ptr = gc.image(*this);
+
+ if (image_ptr.get() && image_ptr->getPixmap())
+ return image_ptr->getWidth();
else {
int font_width = 0;
int baseline, float & x, bool) const
{
Painter & paint = bv->painter();
+ grfx::GCache & gc = grfx::GCache::get();
+ grfx::ImageStatus const status = gc.status(*this);
+
+ // Better to be paranoid and safe!
+ grfx::ImagePtr i_ptr = gc.image(*this);
+ Pixmap const pixmap = (status == grfx::Loaded && i_ptr.get()) ?
+ i_ptr->getPixmap() : 0;
int ldescent = descent(bv, font);
- int lascent = ascent(bv, font);
- int lwidth = width(bv, font);
+ int lascent = ascent(bv, font);
+ int lwidth = width(bv, font);
+
+ Pixmap const check_pixmap = (status == grfx::Loaded && i_ptr.get()) ?
+ i_ptr->getPixmap() : 0;
+
+ if (pixmap != check_pixmap) {
+ // Tell BufferView we need to be updated!
+ bv->text->status(bv, LyXText::CHANGED_IN_DRAW);
+ }
// Make sure x is updated upon exit from this routine
int old_x = int(x);
x += lwidth;
+ // Initiate the loading of the graphics file
+ if (status == grfx::WaitingToLoad) {
+ gc.startLoading(*this);
+ }
+
// This will draw the graphics. If the graphics has not been loaded yet,
// we draw just a rectangle.
- if (imageLoaded) {
+
+ if (pixmap != 0) {
paint.image(old_x + 2, baseline - lascent,
- lwidth - 4, lascent + ldescent,
- cacheHandle->getImage());
+ lwidth - 4, lascent + ldescent, i_ptr);
+
} else {
- // Get the image status, default to unknown error.
- GraphicsCacheItem::ImageStatus status = GraphicsCacheItem::UnknownError;
- if (lyxrc.use_gui && params.display != InsetGraphicsParams::NONE &&
- cacheHandle.get())
- status = cacheHandle->getImageStatus();
- // Check if the image is now ready.
- if (status == GraphicsCacheItem::Loaded) {
- imageLoaded = true;
- // Tell BufferView we need to be updated!
- bv->text->status(bv, LyXText::CHANGED_IN_DRAW);
- return;
- }
+
paint.rectangle(old_x + 2, baseline - lascent,
lwidth - 4,
lascent + ldescent);
+
// Print the file name.
LyXFont msgFont(font);
msgFont.setFamily(LyXFont::SANS_FAMILY);
baseline - lyxfont::maxAscent(msgFont) - 4,
justname, msgFont);
}
+
// Print the message.
string const msg = statusMessage();
if (!msg.empty()) {
}
+// Update the inset after parameters changed (read from file or changed in
+// dialog. The grfx::GCache makes the decisions about whether or not to draw
+// (interogates lyxrc, ascertains whether file exists etc)
+void InsetGraphics::updateInset() const
+{
+ grfx::GCache & gc = grfx::GCache::get();
+ gc.update(*this);
+}
+
+
void InsetGraphics::edit(BufferView *bv, int, int, unsigned int)
{
bv->owner()->getDialogs()->showGraphics(this);
//
// first check if file is viewed in LyX. First local
// than global
- if ((params.display == InsetGraphicsParams::NONE) ||
- ((params.display == InsetGraphicsParams::DEFAULT) &&
- (lyxrc.display_graphics == "no"))) {
- lyxerr << "InsetGraphics::no converting of: " << params.filename << "\n";
- return params.filename;
- }
// if it's a zipped one, than let LaTeX do the rest!!!
- if (zippedFile(params.filename)) {
- lyxerr << "InsetGraphics::prepareFilter(zippedFile): return "
+ if ((zippedFile(params.filename) && params.noUnzip) || buf->niceFile) {
+ lyxerr << "don't unzip file or export latex"
<< params.filename << endl;
return params.filename;
}
+ string filename_ = params.filename;
+ if (zippedFile(filename_))
+ filename_ = unzipFile(filename_);
// now we have unzipped files
// Get the extension (format) of the original file.
// we handle it like a virtual one, so we can have
// different extensions with the same type.
- string const extension = getExtFromContents(params.filename);
- // Are we creating a PDF or a PS file?
- // (Should actually mean, are we usind latex or pdflatex).
+ string const extension = getExtFromContents(filename_);
+ // are we usind latex ((e)ps) or pdflatex (pdf,jpg,png)
string const image_target = decideOutputImageFormat(extension);
- if (extension == image_target)
- return params.filename;
- if (!IsFileReadable(params.filename)) {
+ if (extension == image_target) // :-)
+ return filename_;
+ if (!IsFileReadable(filename_)) { // :-(
Alert::alert(_("File") + params.filename,
_("isn't readable or doesn't exists!"));
- return params.filename;
+ return filename_;
}
string outfile;
- if (!buf->niceFile) {
- string const temp = AddName(buf->tmppath, params.filename);
- lyxerr << "temp = " << temp << "\n";
- outfile = RemoveExtension(temp);
- } else {
- string const path = buf->filePath();
- string const relname = MakeRelPath(params.filename, path);
- outfile = RemoveExtension(relname);
- }
+ string const temp = AddName(buf->tmppath, filename_);
+ outfile = RemoveExtension(temp);
+ lyxerr << "tempname = " << temp << "\n";
lyxerr << "buf::tmppath = " << buf->tmppath << "\n";
- lyxerr << "filename = " << params.filename << "\n";
+ lyxerr << "filename_ = " << filename_ << "\n";
lyxerr << "outfile = " << outfile << endl;
- converters.convert(buf, params.filename, outfile, extension, image_target);
+ converters.convert(buf, filename_, outfile, extension, image_target);
return outfile;
}
return 1; // One end of line marker added to the stream.
}
// Keep count of newlines that we issued.
+#warning the newlines=0 were in the original code. where is the sense? (Herbert)
int newlines = 0;
// This variables collect all the latex code that should be before and
// after the actual includegraphics command.
}
-// Update the inset after parameters changed (read from file or changed in
-// dialog.
-void InsetGraphics::updateInset() const
-{
- GraphicsCache & gc = GraphicsCache::getInstance();
- boost::shared_ptr<GraphicsCacheItem> temp(0);
-
- // We do it this way so that in the face of some error, we will still
- // be in a valid state.
- InsetGraphicsParams::DisplayType local_display = params.display;
- if (local_display == InsetGraphicsParams::DEFAULT) {
- if (lyxrc.display_graphics == "mono")
- local_display = InsetGraphicsParams::MONOCHROME;
- else if (lyxrc.display_graphics == "gray")
- local_display = InsetGraphicsParams::GRAYSCALE;
- else if (lyxrc.display_graphics == "color")
- local_display = InsetGraphicsParams::COLOR;
- else
- local_display = InsetGraphicsParams::NONE;
- }
-
- if (!params.filename.empty() && lyxrc.use_gui &&
- local_display != InsetGraphicsParams::NONE) {
- temp = gc.addFile(params.filename);
- }
-
- // Mark the image as unloaded so that it gets updated.
- imageLoaded = false;
-
- cacheHandle = temp;
-}
-
-
bool InsetGraphics::setParams(InsetGraphicsParams const & p)
{
// If nothing is changed, just return and say so.
#include "sigc++/signal_system.h"
class Dialogs;
-class LyXImage;
///
class InsetGraphics : public Inset, public SigC::Object {
string const createLatexOptions() const;
/// Convert the file if needed, and return the location of the file.
string const prepareFile(Buffer const * buf) const;
- /// The graphics cache handle.
- mutable boost::shared_ptr<GraphicsCacheItem> cacheHandle;
- /// is the pixmap initialized?
- mutable bool imageLoaded;
///
InsetGraphicsParams params;
};
bb = string(); // bounding box
draft = false; // draft mode
clip = false; // clip image
- display = DEFAULT;
+ display = DEFAULT; // see pref
subcaption = false; // subfigure
+ noUnzip = false; // unzip files
width = LyXLength(); // set to 0pt
height = LyXLength();
lyxwidth = LyXLength(); // for the view in lyx
- lyxheight = LyXLength();
- scale = 0;
- lyxscale = 0;
+ lyxheight = LyXLength(); // also set to 0pt
+ scale = 0; // unit is %
+ lyxscale = 0; // same for lyxview
size_type = DEFAULT_SIZE; // do nothing
lyxsize_type = DEFAULT_SIZE; // do nothing
- keepAspectRatio = false; //
+ keepAspectRatio = false; // only for latex
rotate = false; // Rotating
rotateOrigin = "center"; // Origin
rotateAngle = 0.0; // in degrees
display = igp.display;
subcaption = igp.subcaption;
subcaptionText = igp.subcaptionText;
+ noUnzip = igp.noUnzip;
keepAspectRatio = igp.keepAspectRatio;
width = igp.width;
height = igp.height;
left.clip == right.clip &&
left.display == right.display &&
left.subcaption == right.subcaption &&
+ left.noUnzip == right.noUnzip &&
left.subcaptionText == right.subcaptionText &&
left.keepAspectRatio == right.keepAspectRatio &&
left.width == right.width &&
os << "\tclip\n";
if (draft) // draft mode
os << "\tdraft\n";
- // Save the display type
+ // Save the display type for the view inside lyx
os << "\tdisplay " << displayTranslator.find(display) << '\n';
// Save the subcaption status
if (subcaption)
os << "\tsubcaption\n";
if (!subcaptionText.empty())
os << "\tsubcaptionText \"" << subcaptionText << '\"' << '\n';
+ if (noUnzip)
+ os << "\tnoUnzip\n";
// we always need the size type
// 0: no special
// 1: width/height combination
os << "\trotateOrigin " << rotateOrigin << '\n';
if (!special.empty())
os << "\tspecial " << special << '\n';
+ // the values for the view in lyx
os << "\tlyxsize_type " << lyxsize_type << '\n';
if (!lyxwidth.zero()) // the lyx-viewsize
os << "\tlyxwidth " << lyxwidth.asString() << '\n';
} else if (token == "subcaptionText") {
lex.next();
subcaptionText = lex.getString();
- } else if (token == "widthResize") {
- if (lex.next()) {
- string const token = lex.getString();
- if (token == "scale") {
- lex.next();
- scale = lex.getInteger();
- size_type = SCALE;
- }
- else {
- width = convertResizeValue(token, lex);
- size_type = WH;
- }
- }
+ } else if (token == "noUnzip") {
+ noUnzip = true;
} else if (token == "size_type") {
lex.next();
switch (lex.getInteger()) {
lex.next();
width = LyXLength(lex.getString());
size_type = WH;
- } else if (token == "heightResize") {
- if (lex.next())
- height = convertResizeValue(lex.getString(), lex);
} else if (token == "height") {
lex.next();
height = LyXLength(lex.getString());
} else if (token == "lyxscale") {
lex.next();
lyxscale = lex.getInteger();
- } else {
- // If it's none of the above, its not ours.
+ // now the compytibility stuff for "old" 1.2.0 files which uses
+ // the first try of the new graphic inset. Can be deleted, when
+ // 1.3 comes out
+ } else if (token == "widthResize") {
+ if (lex.next()) {
+ string const token = lex.getString();
+ if (token == "scale") {
+ lex.next();
+ scale = lex.getInteger();
+ size_type = SCALE;
+ }
+ else {
+ width = convertResizeValue(token, lex);
+ size_type = WH;
+ }
+ }
+ } else if (token == "heightResize") {
+ if (lex.next())
+ height = convertResizeValue(lex.getString(), lex);
+ // end compytibility stuff
+ } else { // If it's none of the above, its not ours.
return false;
}
return true;
NONE // only keep a frame in place.
};
///
- enum sizeType {
+ enum sizeType { // for latex and/or lyx
DEFAULT_SIZE, // like none
WH, // width/height values
SCALE // percentage value
bool subcaption;
/// The text of the subcaption.
string subcaptionText;
- /// The bounding box with "xLB yLB yRT yRT ", divided by a space!
/// Do we rotate?
bool rotate;
/// Origin point of rotation
string rotateOrigin;
/// Rotation angle.
float rotateAngle;
- string bb;
/// clip image
bool clip;
/// draft mode
bool draft;
- /// How to display the image
- DisplayType display;
- /// any userdefined special command
- string special;
- /// three possible values for rescaling
+ /// what to do with zipped files
+ bool noUnzip;
+ /// The bounding box with "xLB yLB yRT yRT ", divided by a space!
+ string bb;
+ /// Type of rescaling
+ sizeType size_type;
+ /// three possible values for rescaling (latex)
LyXLength width;
///
LyXLength height;
///
int scale;
- /// Type of rescaling
- sizeType size_type;
/// Keep the ratio between height and width when resizing.
bool keepAspectRatio;
+ /// any userdefined special command
+ string special;
+ /// How to display the image inside lyx
+ DisplayType display;
/// the size for the view inside lyx
+ /// Typ of the LyXView, same as for latex
+ sizeType lyxsize_type;
LyXLength lyxwidth;
///
LyXLength lyxheight;
- /// Typ of rescaling the Screen
+ /// Typ of rescaling the Screen inside lyx
int lyxscale;
- /// Typ of the LyXView, same as for latex
- sizeType lyxsize_type;
///
InsetGraphicsParams();
///