FormExternal patch from Rob,

graphics9 patch from Herbert.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3517 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-02-11 10:42:11 +00:00
parent c238196fb2
commit f4c86428a3
12 changed files with 446 additions and 356 deletions

View File

@ -1,3 +1,22 @@
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> 2002-02-08 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* Menubar_pimpl.C (create_submenu): work around an xforms bug (?) * Menubar_pimpl.C (create_submenu): work around an xforms bug (?)

View File

@ -42,6 +42,7 @@ int const WIDTH_MAXDIGITS = 10;
int const HEIGHT_MAXDIGITS = 10; int const HEIGHT_MAXDIGITS = 10;
int const ROTATE_MAXCHARS = 4; int const ROTATE_MAXCHARS = 4;
int const FILENAME_MAXCHARS = 1024; int const FILENAME_MAXCHARS = 1024;
string defaultUnit = "cm";
} // namespace anon } // namespace anon
@ -97,6 +98,7 @@ void FormGraphics::build()
bc().addReadOnly(file_->check_rotate); bc().addReadOnly(file_->check_rotate);
bc().addReadOnly(file_->button_clip); bc().addReadOnly(file_->button_clip);
bc().addReadOnly(file_->button_draft); bc().addReadOnly(file_->button_draft);
bc().addReadOnly(file_->button_nounzip);
// the lyxview section // the lyxview section
lyxview_.reset(build_lyxview()); lyxview_.reset(build_lyxview());
@ -143,10 +145,7 @@ void FormGraphics::build()
fl_set_input_return (bbox_->input_bb_y1, FL_RETURN_CHANGED); fl_set_input_return (bbox_->input_bb_y1, FL_RETURN_CHANGED);
string const bb_units = "pt|cm|in"; string const bb_units = "pt|cm|in";
fl_addto_choice(bbox_->choice_bb_x0, bb_units.c_str()); fl_addto_choice(bbox_->choice_bb_units, 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());
bc().addReadOnly(bbox_->button_getBB); bc().addReadOnly(bbox_->button_getBB);
// the rotate section // the rotate section
@ -188,6 +187,7 @@ void FormGraphics::apply()
igp.rotateOrigin = string(); igp.rotateOrigin = string();
igp.draft = fl_get_button(file_->button_draft); igp.draft = fl_get_button(file_->button_draft);
igp.clip = fl_get_button(file_->button_clip); igp.clip = fl_get_button(file_->button_clip);
igp.noUnzip = fl_get_button(file_->button_nounzip);
// the lyxview section // the lyxview section
if (fl_get_button(lyxview_->radio_pref)) if (fl_get_button(lyxview_->radio_pref))
@ -236,22 +236,22 @@ void FormGraphics::apply()
bb = "0 "; bb = "0 ";
else else
bb = getLengthFromWidgets(bbox_->input_bb_x0, bb = getLengthFromWidgets(bbox_->input_bb_x0,
bbox_->choice_bb_x0)+" "; bbox_->choice_bb_units)+" ";
if (getStringFromInput(bbox_->input_bb_y0).empty()) if (getStringFromInput(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_y0)+" "); bbox_->choice_bb_units)+" ");
if (getStringFromInput(bbox_->input_bb_x1).empty()) if (getStringFromInput(bbox_->input_bb_x1).empty())
bb += "0 "; bb += "0 ";
else else
bb += (getLengthFromWidgets(bbox_->input_bb_x1, bb += (getLengthFromWidgets(bbox_->input_bb_x1,
bbox_->choice_bb_x1)+" "); bbox_->choice_bb_units)+" ");
if (getStringFromInput(bbox_->input_bb_y1).empty()) if (getStringFromInput(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_y1)+" "); bbox_->choice_bb_units)+" ");
igp.bb = bb; igp.bb = bb;
} }
@ -261,10 +261,8 @@ void FormGraphics::apply()
void FormGraphics::update() { void FormGraphics::update() {
string unit = "cm";
if (lyxrc.default_papersize < 3) if (lyxrc.default_papersize < 3)
unit = "in"; defaultUnit = string("in");
string const defaultUnit = string(unit);
// Update dialog with details from inset // Update dialog with details from inset
InsetGraphicsParams & igp = controller().params(); InsetGraphicsParams & igp = controller().params();
@ -287,6 +285,7 @@ void FormGraphics::update() {
fl_get_button(file_->check_rotate)); fl_get_button(file_->check_rotate));
fl_set_button(file_->button_draft, igp.draft); fl_set_button(file_->button_draft, igp.draft);
fl_set_button(file_->button_clip, igp.clip); fl_set_button(file_->button_clip, igp.clip);
fl_set_button(file_->button_nounzip, igp.noUnzip);
// the lyxview section // the lyxview section
switch (igp.display) { switch (igp.display) {
@ -404,16 +403,16 @@ void FormGraphics::update() {
LyXLength anyLength; LyXLength anyLength;
anyLength = LyXLength(token(igp.bb,' ',0)); anyLength = LyXLength(token(igp.bb,' ',0));
updateWidgetsFromLength(bbox_->input_bb_x0, updateWidgetsFromLength(bbox_->input_bb_x0,
bbox_->choice_bb_x0,anyLength,"pt"); bbox_->choice_bb_units,anyLength,"pt");
anyLength = LyXLength(token(igp.bb,' ',1)); anyLength = LyXLength(token(igp.bb,' ',1));
updateWidgetsFromLength(bbox_->input_bb_y0, updateWidgetsFromLength(bbox_->input_bb_y0,
bbox_->choice_bb_y0,anyLength,"pt"); bbox_->choice_bb_units,anyLength,"pt");
anyLength = LyXLength(token(igp.bb,' ',2)); anyLength = LyXLength(token(igp.bb,' ',2));
updateWidgetsFromLength(bbox_->input_bb_x1, updateWidgetsFromLength(bbox_->input_bb_x1,
bbox_->choice_bb_x1,anyLength,"pt"); bbox_->choice_bb_units,anyLength,"pt");
anyLength = LyXLength(token(igp.bb,' ',3)); anyLength = LyXLength(token(igp.bb,' ',3));
updateWidgetsFromLength(bbox_->input_bb_y1, updateWidgetsFromLength(bbox_->input_bb_y1,
bbox_->choice_bb_y1,anyLength,"pt"); bbox_->choice_bb_units,anyLength,"pt");
} }
// the special section // the special section
@ -471,13 +470,23 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
setEnabled(lyxview_->input_lyxheight, 0); setEnabled(lyxview_->input_lyxheight, 0);
setEnabled(lyxview_->choice_width_lyxheight, 0); setEnabled(lyxview_->choice_width_lyxheight, 0);
setEnabled(lyxview_->input_lyxscale, 1); 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 // the bb section
} else if (!controller().bbChanged && } else if (!controller().bbChanged &&
(ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_y0 || (ob == bbox_->choice_bb_units ||
ob == bbox_->input_bb_x1 || ob == bbox_->input_bb_y1 || ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_y0 ||
ob == bbox_->choice_bb_x0 || ob == bbox_->choice_bb_y0 || ob == bbox_->input_bb_x1 || ob == bbox_->input_bb_y1)) {
ob == bbox_->choice_bb_x1 || ob == bbox_->choice_bb_y1)) {
controller().bbChanged = true; controller().bbChanged = true;
} else if (ob == bbox_->button_getBB) { } else if (ob == bbox_->button_getBB) {
string const filename = getStringFromInput(file_->input_filename); string const filename = getStringFromInput(file_->input_filename);
@ -485,19 +494,19 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
string const fileWithAbsPath = MakeAbsPath(filename, OnlyPath(filename)); string const fileWithAbsPath = MakeAbsPath(filename, OnlyPath(filename));
string bb = controller().readBB(fileWithAbsPath); string bb = controller().readBB(fileWithAbsPath);
lyxerr << "getBB::BoundingBox = " << bb << "\n"; lyxerr << "getBB::BoundingBox = " << bb << "\n";
if (!bb.empty()) { if (!bb.empty()) {
updateWidgetsFromLengthString(bbox_->input_bb_x0, updateWidgetsFromLengthString(bbox_->input_bb_x0,
bbox_->choice_bb_x0, bbox_->choice_bb_units,
token(bb,' ',0), "pt"); token(bb,' ',0), "pt");
updateWidgetsFromLengthString(bbox_->input_bb_y0, updateWidgetsFromLengthString(bbox_->input_bb_y0,
bbox_->choice_bb_y0, bbox_->choice_bb_units,
token(bb,' ',1), "pt"); token(bb,' ',1), "pt");
updateWidgetsFromLengthString(bbox_->input_bb_x1, updateWidgetsFromLengthString(bbox_->input_bb_x1,
bbox_->choice_bb_x1, bbox_->choice_bb_units,
token(bb,' ',2), "pt"); token(bb,' ',2), "pt");
updateWidgetsFromLengthString(bbox_->input_bb_y1, updateWidgetsFromLengthString(bbox_->input_bb_y1,
bbox_->choice_bb_y1, bbox_->choice_bb_units,
token(bb,' ',3), "pt"); token(bb,' ',3), "pt");
} }
controller().bbChanged = false; controller().bbChanged = false;
} }
@ -524,6 +533,17 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
setEnabled(size_->choice_height_units, 0); setEnabled(size_->choice_height_units, 0);
setEnabled(size_->check_aspectratio, 0); setEnabled(size_->check_aspectratio, 0);
setEnabled(size_->input_scale, 1); setEnabled(size_->input_scale, 1);
} else if (ob == size_->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 // check if the input is valid

View File

@ -31,6 +31,7 @@ FD_form_external * FormExternal::build_external()
fl_set_button_shortcut(obj, scex(_(dummy)), 1); fl_set_button_shortcut(obj, scex(_(dummy)), 1);
} }
fl_set_object_boxtype(obj, FL_FRAME_BOX); 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_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
@ -66,7 +67,6 @@ FD_form_external * FormExternal::build_external()
fdui->button_edit = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 50, 110, 30, idex(_(dummy))); 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_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_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast); fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
@ -75,7 +75,6 @@ FD_form_external * FormExternal::build_external()
fdui->button_view = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 90, 110, 30, idex(_(dummy))); 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_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_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast); fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
@ -84,12 +83,10 @@ FD_form_external * FormExternal::build_external()
fdui->button_update = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 130, 110, 30, idex(_(dummy))); 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_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_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast); fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 255, 270, 90, 30, _("OK")); 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_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseOKCB, 0); fl_set_object_callback(obj, C_FormBaseOKCB, 0);
@ -98,7 +95,6 @@ FD_form_external * FormExternal::build_external()
fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 355, 270, 90, 30, idex(_(dummy))); 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_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_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseApplyCB, 0); fl_set_object_callback(obj, C_FormBaseApplyCB, 0);

View File

@ -106,7 +106,7 @@ FD_form_file * FormGraphics::build_file()
fl_set_object_lalign(obj, FL_ALIGN_RIGHT); fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); 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))); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
@ -116,7 +116,7 @@ FD_form_file * FormGraphics::build_file()
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE); 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))); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
@ -126,7 +126,7 @@ FD_form_file * FormGraphics::build_file()
fl_set_object_lsize(obj, FL_NORMAL_SIZE); 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_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))); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
@ -138,7 +138,7 @@ FD_form_file * FormGraphics::build_file()
fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_set_object_lstyle(obj, FL_BOLD_STYLE);
{ {
char const * const dummy = N_("clip to bounding box|#b"); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
@ -160,6 +160,14 @@ FD_form_file * FormGraphics::build_file()
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_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); 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(); fl_end_form();
fdui->form->fdui = fdui; fdui->form->fdui = fdui;
@ -219,7 +227,7 @@ FD_form_size * FormGraphics::build_size()
fl_end_group(); 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))); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
@ -230,7 +238,7 @@ FD_form_size * FormGraphics::build_size()
fl_set_object_lsize(obj, FL_NORMAL_SIZE); 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_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))); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
@ -241,7 +249,7 @@ FD_form_size * FormGraphics::build_size()
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); 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))); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
@ -260,6 +268,14 @@ FD_form_size * FormGraphics::build_size()
fl_set_object_lalign(obj, FL_ALIGN_RIGHT); fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 15, 60, 470, 65, ""); 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(); fl_end_form();
fdui->form->fdui = fdui; fdui->form->fdui = fdui;
@ -284,63 +300,50 @@ FD_form_bbox * FormGraphics::build_bbox()
fdui->form->u_vdata = this; fdui->form->u_vdata = this;
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 505, 235, ""); obj = fl_add_box(FL_FLAT_BOX, 0, 0, 505, 235, "");
fl_set_object_lsize(obj, FL_NORMAL_SIZE); 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); 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_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); 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_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); fl_set_object_lstyle(obj, FL_BOLD_STYLE);
{ {
char const * const dummy = N_("Left Bottom:|#L"); char const * const dummy = N_("Top right ( |#T");
fdui->input_bb_x0 = obj = fl_add_input(FL_NORMAL_INPUT, 135, 60, 50, 30, idex(_(dummy))); 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_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_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->choice_bb_x0 = obj = fl_add_choice(FL_NORMAL_CHOICE, 190, 60, 50, 30, ""); fdui->input_bb_y1 = obj = fl_add_input(FL_NORMAL_INPUT, 220, 45, 50, 30, _(" )"));
fl_set_object_boxtype(obj, FL_FRAME_BOX);
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); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{ {
char const * const dummy = N_("Right Top:|#R"); char const * const dummy = N_("Bottom left ( |#B");
fdui->input_bb_x1 = obj = fl_add_input(FL_NORMAL_INPUT, 135, 100, 50, 30, idex(_(dummy))); 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_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_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->choice_bb_x1 = obj = fl_add_choice(FL_NORMAL_CHOICE, 190, 100, 50, 30, ""); fdui->input_bb_y0 = obj = fl_add_input(FL_NORMAL_INPUT, 220, 95, 50, 30, _(" )"));
fl_set_object_boxtype(obj, FL_FRAME_BOX);
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); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{ {
char const * const dummy = N_("Left Bottom:|#f"); char const * const dummy = N_("Units|#U");
fdui->input_bb_y0 = obj = fl_add_input(FL_NORMAL_INPUT, 360, 60, 50, 30, idex(_(dummy))); 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_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); fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{ {
char const * const dummy = N_("Right Top:|#T"); char const * const dummy = N_("Get values from file|#G");
fdui->input_bb_y1 = obj = fl_add_input(FL_NORMAL_INPUT, 360, 100, 50, 30, idex(_(dummy))); 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);
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)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1); fl_set_button_shortcut(obj, scex(_(dummy)), 1);
} }
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
@ -372,7 +375,7 @@ FD_form_special * FormGraphics::build_special()
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 15, 15, 455, 70, _("Special Options")); obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 15, 15, 455, 70, _("Special Options"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE); 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))); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
@ -405,7 +408,7 @@ FD_form_lyxview * FormGraphics::build_lyxview()
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE); 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))); fdui->input_lyxscale = obj = fl_add_input(FL_NORMAL_INPUT, 350, 75, 70, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1); fl_set_button_shortcut(obj, scex(_(dummy)), 1);
} }
@ -493,7 +496,7 @@ FD_form_lyxview * FormGraphics::build_lyxview()
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 150, 10, 340, 50, _("Screen Size")); obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 150, 10, 340, 50, _("Screen Size"));
fl_set_object_lstyle(obj, FL_BOLD_STYLE); 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))); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
@ -504,7 +507,7 @@ FD_form_lyxview * FormGraphics::build_lyxview()
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); 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))); fdui->input_lyxheight = obj = fl_add_input(FL_NORMAL_INPUT, 350, 170, 70, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1); fl_set_button_shortcut(obj, scex(_(dummy)), 1);
} }
@ -518,6 +521,14 @@ FD_form_lyxview * FormGraphics::build_lyxview()
obj = fl_add_text(FL_NORMAL_TEXT, 30, 45, 115, 25, _("(from Preferences)")); obj = fl_add_text(FL_NORMAL_TEXT, 30, 45, 115, 25, _("(from Preferences)"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE); 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_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(); fl_end_form();
fdui->form->fdui = fdui; fdui->form->fdui = fdui;

View File

@ -46,6 +46,7 @@ struct FD_form_file {
FL_OBJECT *button_clip; FL_OBJECT *button_clip;
FL_OBJECT *button_draft; FL_OBJECT *button_draft;
FL_OBJECT *check_rotate; FL_OBJECT *check_rotate;
FL_OBJECT *button_nounzip;
}; };
struct FD_form_size { struct FD_form_size {
~FD_form_size(); ~FD_form_size();
@ -61,19 +62,17 @@ struct FD_form_size {
FL_OBJECT *input_height; FL_OBJECT *input_height;
FL_OBJECT *choice_height_units; FL_OBJECT *choice_height_units;
FL_OBJECT *check_aspectratio; FL_OBJECT *check_aspectratio;
FL_OBJECT *button_lyx_values;
}; };
struct FD_form_bbox { struct FD_form_bbox {
~FD_form_bbox(); ~FD_form_bbox();
FL_FORM *form; FL_FORM *form;
FL_OBJECT *input_bb_x0;
FL_OBJECT *choice_bb_x0;
FL_OBJECT *input_bb_x1; 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 *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; FL_OBJECT *button_getBB;
}; };
struct FD_form_special { struct FD_form_special {
@ -100,6 +99,7 @@ struct FD_form_lyxview {
FL_OBJECT *choice_width_lyxwidth; FL_OBJECT *choice_width_lyxwidth;
FL_OBJECT *input_lyxheight; FL_OBJECT *input_lyxheight;
FL_OBJECT *choice_width_lyxheight; FL_OBJECT *choice_width_lyxheight;
FL_OBJECT *button_latex_values;
}; };
#endif /* FD_form_graphics_h_ */ #endif /* FD_form_graphics_h_ */

View File

@ -35,7 +35,7 @@ class: FL_CHOICE
type: NORMAL_CHOICE type: NORMAL_CHOICE
box: 130 10 300 30 box: 130 10 300 30
boxtype: FL_FRAME_BOX boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK colors: FL_COL1 FL_RIGHT_BCOL
alignment: FL_ALIGN_LEFT alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
@ -125,7 +125,7 @@ class: FL_BUTTON
type: NORMAL_BUTTON type: NORMAL_BUTTON
box: 435 50 110 30 box: 435 50 110 30
boxtype: FL_UP_BOX boxtype: FL_UP_BOX
colors: FL_COL1 FL_BLACK colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
@ -143,7 +143,7 @@ class: FL_BUTTON
type: NORMAL_BUTTON type: NORMAL_BUTTON
box: 435 90 110 30 box: 435 90 110 30
boxtype: FL_UP_BOX boxtype: FL_UP_BOX
colors: FL_COL1 FL_BLACK colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
@ -161,7 +161,7 @@ class: FL_BUTTON
type: NORMAL_BUTTON type: NORMAL_BUTTON
box: 435 130 110 30 box: 435 130 110 30
boxtype: FL_UP_BOX boxtype: FL_UP_BOX
colors: FL_COL1 FL_BLACK colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
@ -179,7 +179,7 @@ class: FL_BUTTON
type: RETURN_BUTTON type: RETURN_BUTTON
box: 255 270 90 30 box: 255 270 90 30
boxtype: FL_UP_BOX boxtype: FL_UP_BOX
colors: FL_COL1 FL_BLACK colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
@ -197,7 +197,7 @@ class: FL_BUTTON
type: NORMAL_BUTTON type: NORMAL_BUTTON
box: 355 270 90 30 box: 355 270 90 30
boxtype: FL_UP_BOX boxtype: FL_UP_BOX
colors: FL_COL1 FL_BLACK colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE

View File

@ -143,7 +143,7 @@ argument:
Name: form_file Name: form_file
Width: 505 Width: 505
Height: 235 Height: 235
Number of Objects: 14 Number of Objects: 15
-------------------- --------------------
class: FL_BOX class: FL_BOX
@ -245,7 +245,7 @@ alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Title:|#T label: Title|#T
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -281,7 +281,7 @@ alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Angle:|#n label: Angle|#n
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -317,7 +317,7 @@ alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Origin:|#O label: Origin|#O
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -346,7 +346,7 @@ argument:
-------------------- --------------------
class: FL_CHECKBUTTON class: FL_CHECKBUTTON
type: PUSH_BUTTON type: PUSH_BUTTON
box: 145 190 30 30 box: 140 190 30 30
boxtype: FL_NO_BOX boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_RIGHT alignment: FL_ALIGN_RIGHT
@ -397,11 +397,29 @@ name: check_rotate
callback: C_FormBaseInputCB callback: C_FormBaseInputCB
argument: 0 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 =============== =============== FORM ===============
Name: form_size Name: form_size
Width: 505 Width: 505
Height: 235 Height: 235
Number of Objects: 15 Number of Objects: 17
-------------------- --------------------
class: FL_BOX class: FL_BOX
@ -539,7 +557,7 @@ alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Value:|#V label: Value|#V
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -575,7 +593,7 @@ alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Width:|#W label: Width|#W
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -611,7 +629,7 @@ alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Height:|#g label: Height|#g
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -673,11 +691,47 @@ name:
callback: callback:
argument: 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 =============== =============== FORM ===============
Name: form_bbox Name: form_bbox
Width: 505 Width: 505
Height: 235 Height: 235
Number of Objects: 13 Number of Objects: 10
-------------------- --------------------
class: FL_BOX class: FL_BOX
@ -700,14 +754,14 @@ argument:
-------------------- --------------------
class: FL_LABELFRAME class: FL_LABELFRAME
type: ENGRAVED_FRAME type: ENGRAVED_FRAME
box: 20 25 455 195 box: 15 10 475 205
boxtype: FL_NO_BOX boxtype: FL_UP_BOX
colors: FL_BLACK FL_COL1 colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: label: Corner coordinates (X, Y)
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -718,14 +772,14 @@ argument:
-------------------- --------------------
class: FL_TEXT class: FL_TEXT
type: NORMAL_TEXT type: NORMAL_TEXT
box: 135 35 35 25 box: 195 110 30 25
boxtype: FL_FLAT_BOX boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_BOLD_STYLE style: FL_BOLD_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: X label: ,
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -736,14 +790,14 @@ argument:
-------------------- --------------------
class: FL_TEXT class: FL_TEXT
type: NORMAL_TEXT type: NORMAL_TEXT
box: 360 35 30 25 box: 195 55 30 25
boxtype: FL_FLAT_BOX boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_BOLD_STYLE style: FL_BOLD_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Y label: ,
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -754,50 +808,14 @@ argument:
-------------------- --------------------
class: FL_INPUT class: FL_INPUT
type: NORMAL_INPUT type: NORMAL_INPUT
box: 135 60 50 30 box: 150 45 50 30
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
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK 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
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 135 100 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: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -806,34 +824,52 @@ callback: C_FormBaseInputCB
argument: 0 argument: 0
-------------------- --------------------
class: FL_CHOICE class: FL_INPUT
type: NORMAL_CHOICE type: NORMAL_INPUT
box: 190 100 50 30 box: 220 45 50 30
boxtype: FL_FRAME_BOX boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_BLACK colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: label: )
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: choice_bb_x1 name: input_bb_y1
callback: C_FormBaseInputCB callback: C_FormBaseInputCB
argument: 0 argument: 0
-------------------- --------------------
class: FL_INPUT class: FL_INPUT
type: NORMAL_INPUT type: NORMAL_INPUT
box: 360 60 50 30 box: 150 95 50 30
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
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Left Bottom:|#f label: Bottom left ( |#B
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_bb_x0
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 220 95 50 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: )
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -844,68 +880,32 @@ argument: 0
-------------------- --------------------
class: FL_CHOICE class: FL_CHOICE
type: NORMAL_CHOICE type: NORMAL_CHOICE
box: 415 60 45 30 box: 370 70 45 30
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
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: label: Units|#U
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: choice_bb_y0 name: choice_bb_units
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 360 100 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:|#T
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_bb_y1
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 415 100 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_y1
callback: C_FormBaseInputCB callback: C_FormBaseInputCB
argument: 0 argument: 0
-------------------- --------------------
class: FL_BUTTON class: FL_BUTTON
type: NORMAL_BUTTON type: NORMAL_BUTTON
box: 135 160 220 30 box: 110 160 165 30
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
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Get bounding box from file|#G label: Get values from file|#G
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -965,7 +965,7 @@ alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: LaTeX Options:|#L label: LaTeX Options|#L
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -977,7 +977,7 @@ argument: 0
Name: form_lyxview Name: form_lyxview
Width: 505 Width: 505
Height: 235 Height: 235
Number of Objects: 24 Number of Objects: 26
-------------------- --------------------
class: FL_BOX class: FL_BOX
@ -1025,7 +1025,7 @@ alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Value:|#V label: Value|#V
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -1313,7 +1313,7 @@ alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Width:|#w label: Width|#w
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -1349,7 +1349,7 @@ alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Height:|#h label: Height|#h
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
@ -1411,5 +1411,41 @@ name:
callback: callback:
argument: 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:
============================== ==============================
-------------------- --------------------

View File

@ -1,3 +1,11 @@
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> 2002-02-08 Herbert Voss <voss@lyx.org>
* insetgraphic.C: prepareFile(): fix bug when file doesn't * insetgraphic.C: prepareFile(): fix bug when file doesn't

View File

@ -93,6 +93,7 @@ TODO Before initial production release:
#include "insets/insetgraphicsParams.h" #include "insets/insetgraphicsParams.h"
#include "graphics/GraphicsCache.h" #include "graphics/GraphicsCache.h"
#include "graphics/GraphicsCacheItem.h" #include "graphics/GraphicsCacheItem.h"
#include "graphics/GraphicsImage.h"
#include "frontends/Dialogs.h" #include "frontends/Dialogs.h"
#include "frontends/Alert.h" #include "frontends/Alert.h"
@ -100,7 +101,6 @@ TODO Before initial production release:
#include "buffer.h" #include "buffer.h"
#include "BufferView.h" #include "BufferView.h"
#include "converter.h" #include "converter.h"
#include "frontends/support/LyXImage.h"
#include "Painter.h" #include "Painter.h"
#include "lyx_gui_misc.h" #include "lyx_gui_misc.h"
#include "support/FileInfo.h" #include "support/FileInfo.h"
@ -135,16 +135,11 @@ string const RemoveExtension(string const & filename)
} }
// Initialize only those variables that do not have a constructor.
InsetGraphics::InsetGraphics() InsetGraphics::InsetGraphics()
: cacheHandle(0), imageLoaded(false)
{} {}
InsetGraphics::InsetGraphics(InsetGraphics const & ig, bool same_id) InsetGraphics::InsetGraphics(InsetGraphics const & ig, bool same_id)
: Inset(), SigC::Object()
, cacheHandle(ig.cacheHandle)
, imageLoaded(ig.imageLoaded)
{ {
setParams(ig.getParams()); setParams(ig.getParams());
if (same_id) if (same_id)
@ -154,6 +149,9 @@ InsetGraphics::InsetGraphics(InsetGraphics const & ig, bool same_id)
InsetGraphics::~InsetGraphics() InsetGraphics::~InsetGraphics()
{ {
grfx::GCache & gc = grfx::GCache::get();
gc.remove(*this);
// Emits the hide signal to the dialog connected (if any) // Emits the hide signal to the dialog connected (if any)
hideDialog(); hideDialog();
} }
@ -162,37 +160,50 @@ InsetGraphics::~InsetGraphics()
string const InsetGraphics::statusMessage() const string const InsetGraphics::statusMessage() const
{ {
string msg; string msg;
if (cacheHandle.get()) { grfx::GCache const & gc = grfx::GCache::get();
switch (cacheHandle->getImageStatus()) { grfx::ImageStatus const status = gc.status(*this);
case GraphicsCacheItem::UnknownError:
msg = _("Unknown Error"); switch (status) {
break; case grfx::WaitingToLoad:
case GraphicsCacheItem::Loading: msg = _("Waiting for draw request to start loading...");
msg = _("Loading..."); break;
break; case grfx::Loading:
case GraphicsCacheItem::ErrorReading: msg = _("Loading...");
msg = _("Error reading"); break;
break; case grfx::Converting:
case GraphicsCacheItem::Converting: msg = _("Converting to loadable format...");
msg = _("Converting Image"); break;
break; case grfx::ScalingEtc:
case GraphicsCacheItem::ErrorConverting: msg = _("Loaded. Scaling etc...");
msg = _("Error converting"); break;
break; case grfx::ErrorLoading:
case GraphicsCacheItem::Loaded: msg = _("Error loading");
// No message to write. break;
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; return msg;
} }
int InsetGraphics::ascent(BufferView *, LyXFont const &) const int InsetGraphics::ascent(BufferView *, LyXFont const &) const
{ {
LyXImage * pixmap = 0; grfx::GCache const & gc = grfx::GCache::get();
if (cacheHandle.get() && (pixmap = cacheHandle->getImage())) grfx::ImagePtr const image_ptr = gc.image(*this);
return pixmap->getHeight();
if (image_ptr.get() && image_ptr->getPixmap())
return image_ptr->getHeight();
else else
return 50; return 50;
} }
@ -207,10 +218,11 @@ int InsetGraphics::descent(BufferView *, LyXFont const &) const
int InsetGraphics::width(BufferView *, LyXFont const & font) const int InsetGraphics::width(BufferView *, LyXFont const & font) const
{ {
LyXImage * pixmap = 0; grfx::GCache const & gc = grfx::GCache::get();
grfx::ImagePtr const image_ptr = gc.image(*this);
if (cacheHandle.get() && (pixmap = cacheHandle->getImage()))
return pixmap->getWidth(); if (image_ptr.get() && image_ptr->getPixmap())
return image_ptr->getWidth();
else { else {
int font_width = 0; int font_width = 0;
@ -239,38 +251,49 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
int baseline, float & x, bool) const int baseline, float & x, bool) const
{ {
Painter & paint = bv->painter(); 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 ldescent = descent(bv, font);
int lascent = ascent(bv, font); int lascent = ascent(bv, font);
int lwidth = width(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 // Make sure x is updated upon exit from this routine
int old_x = int(x); int old_x = int(x);
x += lwidth; 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, // This will draw the graphics. If the graphics has not been loaded yet,
// we draw just a rectangle. // we draw just a rectangle.
if (imageLoaded) {
if (pixmap != 0) {
paint.image(old_x + 2, baseline - lascent, paint.image(old_x + 2, baseline - lascent,
lwidth - 4, lascent + ldescent, lwidth - 4, lascent + ldescent, i_ptr);
cacheHandle->getImage());
} else { } 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, paint.rectangle(old_x + 2, baseline - lascent,
lwidth - 4, lwidth - 4,
lascent + ldescent); lascent + ldescent);
// Print the file name. // Print the file name.
LyXFont msgFont(font); LyXFont msgFont(font);
msgFont.setFamily(LyXFont::SANS_FAMILY); msgFont.setFamily(LyXFont::SANS_FAMILY);
@ -281,6 +304,7 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
baseline - lyxfont::maxAscent(msgFont) - 4, baseline - lyxfont::maxAscent(msgFont) - 4,
justname, msgFont); justname, msgFont);
} }
// Print the message. // Print the message.
string const msg = statusMessage(); string const msg = statusMessage();
if (!msg.empty()) { if (!msg.empty()) {
@ -291,6 +315,16 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
} }
// 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) void InsetGraphics::edit(BufferView *bv, int, int, unsigned int)
{ {
bv->owner()->getDialogs()->showGraphics(this); bv->owner()->getDialogs()->showGraphics(this);
@ -536,47 +570,37 @@ string const InsetGraphics::prepareFile(Buffer const *buf) const
// //
// first check if file is viewed in LyX. First local // first check if file is viewed in LyX. First local
// than global // 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 it's a zipped one, than let LaTeX do the rest!!!
if (zippedFile(params.filename)) { if ((zippedFile(params.filename) && params.noUnzip) || buf->niceFile) {
lyxerr << "InsetGraphics::prepareFilter(zippedFile): return " lyxerr << "don't unzip file or export latex"
<< params.filename << endl; << params.filename << endl;
return params.filename; return params.filename;
} }
string filename_ = params.filename;
if (zippedFile(filename_))
filename_ = unzipFile(filename_);
// now we have unzipped files // now we have unzipped files
// Get the extension (format) of the original file. // Get the extension (format) of the original file.
// we handle it like a virtual one, so we can have // we handle it like a virtual one, so we can have
// different extensions with the same type. // different extensions with the same type.
string const extension = getExtFromContents(params.filename); string const extension = getExtFromContents(filename_);
// Are we creating a PDF or a PS file? // are we usind latex ((e)ps) or pdflatex (pdf,jpg,png)
// (Should actually mean, are we usind latex or pdflatex).
string const image_target = decideOutputImageFormat(extension); string const image_target = decideOutputImageFormat(extension);
if (extension == image_target) if (extension == image_target) // :-)
return params.filename; return filename_;
if (!IsFileReadable(params.filename)) { if (!IsFileReadable(filename_)) { // :-(
Alert::alert(_("File") + params.filename, Alert::alert(_("File") + params.filename,
_("isn't readable or doesn't exists!")); _("isn't readable or doesn't exists!"));
return params.filename; return filename_;
} }
string outfile; string outfile;
if (!buf->niceFile) { string const temp = AddName(buf->tmppath, filename_);
string const temp = AddName(buf->tmppath, params.filename); outfile = RemoveExtension(temp);
lyxerr << "temp = " << temp << "\n"; lyxerr << "tempname = " << temp << "\n";
outfile = RemoveExtension(temp);
} else {
string const path = buf->filePath();
string const relname = MakeRelPath(params.filename, path);
outfile = RemoveExtension(relname);
}
lyxerr << "buf::tmppath = " << buf->tmppath << "\n"; lyxerr << "buf::tmppath = " << buf->tmppath << "\n";
lyxerr << "filename = " << params.filename << "\n"; lyxerr << "filename_ = " << filename_ << "\n";
lyxerr << "outfile = " << outfile << endl; lyxerr << "outfile = " << outfile << endl;
converters.convert(buf, params.filename, outfile, extension, image_target); converters.convert(buf, filename_, outfile, extension, image_target);
return outfile; return outfile;
} }
@ -592,6 +616,7 @@ int InsetGraphics::latex(Buffer const *buf, ostream & os,
return 1; // One end of line marker added to the stream. return 1; // One end of line marker added to the stream.
} }
// Keep count of newlines that we issued. // Keep count of newlines that we issued.
#warning the newlines=0 were in the original code. where is the sense? (Herbert)
int newlines = 0; int newlines = 0;
// This variables collect all the latex code that should be before and // This variables collect all the latex code that should be before and
// after the actual includegraphics command. // after the actual includegraphics command.
@ -672,39 +697,6 @@ void InsetGraphics::validate(LaTeXFeatures & features) const
} }
// 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) bool InsetGraphics::setParams(InsetGraphicsParams const & p)
{ {
// If nothing is changed, just return and say so. // If nothing is changed, just return and say so.

View File

@ -30,7 +30,6 @@
#include "sigc++/signal_system.h" #include "sigc++/signal_system.h"
class Dialogs; class Dialogs;
class LyXImage;
/// ///
class InsetGraphics : public Inset, public SigC::Object { class InsetGraphics : public Inset, public SigC::Object {
@ -113,10 +112,6 @@ private:
string const createLatexOptions() const; string const createLatexOptions() const;
/// Convert the file if needed, and return the location of the file. /// Convert the file if needed, and return the location of the file.
string const prepareFile(Buffer const * buf) const; 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; InsetGraphicsParams params;
}; };

View File

@ -97,17 +97,18 @@ void InsetGraphicsParams::init()
bb = string(); // bounding box bb = string(); // bounding box
draft = false; // draft mode draft = false; // draft mode
clip = false; // clip image clip = false; // clip image
display = DEFAULT; display = DEFAULT; // see pref
subcaption = false; // subfigure subcaption = false; // subfigure
noUnzip = false; // unzip files
width = LyXLength(); // set to 0pt width = LyXLength(); // set to 0pt
height = LyXLength(); height = LyXLength();
lyxwidth = LyXLength(); // for the view in lyx lyxwidth = LyXLength(); // for the view in lyx
lyxheight = LyXLength(); lyxheight = LyXLength(); // also set to 0pt
scale = 0; scale = 0; // unit is %
lyxscale = 0; lyxscale = 0; // same for lyxview
size_type = DEFAULT_SIZE; // do nothing size_type = DEFAULT_SIZE; // do nothing
lyxsize_type = DEFAULT_SIZE; // do nothing lyxsize_type = DEFAULT_SIZE; // do nothing
keepAspectRatio = false; // keepAspectRatio = false; // only for latex
rotate = false; // Rotating rotate = false; // Rotating
rotateOrigin = "center"; // Origin rotateOrigin = "center"; // Origin
rotateAngle = 0.0; // in degrees rotateAngle = 0.0; // in degrees
@ -123,6 +124,7 @@ void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
display = igp.display; display = igp.display;
subcaption = igp.subcaption; subcaption = igp.subcaption;
subcaptionText = igp.subcaptionText; subcaptionText = igp.subcaptionText;
noUnzip = igp.noUnzip;
keepAspectRatio = igp.keepAspectRatio; keepAspectRatio = igp.keepAspectRatio;
width = igp.width; width = igp.width;
height = igp.height; height = igp.height;
@ -147,6 +149,7 @@ bool operator==(InsetGraphicsParams const & left,
left.clip == right.clip && left.clip == right.clip &&
left.display == right.display && left.display == right.display &&
left.subcaption == right.subcaption && left.subcaption == right.subcaption &&
left.noUnzip == right.noUnzip &&
left.subcaptionText == right.subcaptionText && left.subcaptionText == right.subcaptionText &&
left.keepAspectRatio == right.keepAspectRatio && left.keepAspectRatio == right.keepAspectRatio &&
left.width == right.width && left.width == right.width &&
@ -188,13 +191,15 @@ void InsetGraphicsParams::Write(Buffer const * buf, ostream & os) const
os << "\tclip\n"; os << "\tclip\n";
if (draft) // draft mode if (draft) // draft mode
os << "\tdraft\n"; os << "\tdraft\n";
// Save the display type // Save the display type for the view inside lyx
os << "\tdisplay " << displayTranslator.find(display) << '\n'; os << "\tdisplay " << displayTranslator.find(display) << '\n';
// Save the subcaption status // Save the subcaption status
if (subcaption) if (subcaption)
os << "\tsubcaption\n"; os << "\tsubcaption\n";
if (!subcaptionText.empty()) if (!subcaptionText.empty())
os << "\tsubcaptionText \"" << subcaptionText << '\"' << '\n'; os << "\tsubcaptionText \"" << subcaptionText << '\"' << '\n';
if (noUnzip)
os << "\tnoUnzip\n";
// we always need the size type // we always need the size type
// 0: no special // 0: no special
// 1: width/height combination // 1: width/height combination
@ -216,6 +221,7 @@ void InsetGraphicsParams::Write(Buffer const * buf, ostream & os) const
os << "\trotateOrigin " << rotateOrigin << '\n'; os << "\trotateOrigin " << rotateOrigin << '\n';
if (!special.empty()) if (!special.empty())
os << "\tspecial " << special << '\n'; os << "\tspecial " << special << '\n';
// the values for the view in lyx
os << "\tlyxsize_type " << lyxsize_type << '\n'; os << "\tlyxsize_type " << lyxsize_type << '\n';
if (!lyxwidth.zero()) // the lyx-viewsize if (!lyxwidth.zero()) // the lyx-viewsize
os << "\tlyxwidth " << lyxwidth.asString() << '\n'; os << "\tlyxwidth " << lyxwidth.asString() << '\n';
@ -254,19 +260,8 @@ bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
} else if (token == "subcaptionText") { } else if (token == "subcaptionText") {
lex.next(); lex.next();
subcaptionText = lex.getString(); subcaptionText = lex.getString();
} else if (token == "widthResize") { } else if (token == "noUnzip") {
if (lex.next()) { noUnzip = true;
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 == "size_type") { } else if (token == "size_type") {
lex.next(); lex.next();
switch (lex.getInteger()) { switch (lex.getInteger()) {
@ -280,9 +275,6 @@ bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
lex.next(); lex.next();
width = LyXLength(lex.getString()); width = LyXLength(lex.getString());
size_type = WH; size_type = WH;
} else if (token == "heightResize") {
if (lex.next())
height = convertResizeValue(lex.getString(), lex);
} else if (token == "height") { } else if (token == "height") {
lex.next(); lex.next();
height = LyXLength(lex.getString()); height = LyXLength(lex.getString());
@ -318,8 +310,27 @@ bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
} else if (token == "lyxscale") { } else if (token == "lyxscale") {
lex.next(); lex.next();
lyxscale = lex.getInteger(); lyxscale = lex.getInteger();
} else { // now the compytibility stuff for "old" 1.2.0 files which uses
// If it's none of the above, its not ours. // 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 false;
} }
return true; return true;

View File

@ -36,7 +36,7 @@ struct InsetGraphicsParams
NONE // only keep a frame in place. NONE // only keep a frame in place.
}; };
/// ///
enum sizeType { enum sizeType { // for latex and/or lyx
DEFAULT_SIZE, // like none DEFAULT_SIZE, // like none
WH, // width/height values WH, // width/height values
SCALE // percentage value SCALE // percentage value
@ -47,40 +47,42 @@ struct InsetGraphicsParams
bool subcaption; bool subcaption;
/// The text of the subcaption. /// The text of the subcaption.
string subcaptionText; string subcaptionText;
/// The bounding box with "xLB yLB yRT yRT ", divided by a space!
/// Do we rotate? /// Do we rotate?
bool rotate; bool rotate;
/// Origin point of rotation /// Origin point of rotation
string rotateOrigin; string rotateOrigin;
/// Rotation angle. /// Rotation angle.
float rotateAngle; float rotateAngle;
string bb;
/// clip image /// clip image
bool clip; bool clip;
/// draft mode /// draft mode
bool draft; bool draft;
/// How to display the image /// what to do with zipped files
DisplayType display; bool noUnzip;
/// any userdefined special command /// The bounding box with "xLB yLB yRT yRT ", divided by a space!
string special; string bb;
/// three possible values for rescaling /// Type of rescaling
sizeType size_type;
/// three possible values for rescaling (latex)
LyXLength width; LyXLength width;
/// ///
LyXLength height; LyXLength height;
/// ///
int scale; int scale;
/// Type of rescaling
sizeType size_type;
/// Keep the ratio between height and width when resizing. /// Keep the ratio between height and width when resizing.
bool keepAspectRatio; bool keepAspectRatio;
/// any userdefined special command
string special;
/// How to display the image inside lyx
DisplayType display;
/// the size for the view inside lyx /// the size for the view inside lyx
/// Typ of the LyXView, same as for latex
sizeType lyxsize_type;
LyXLength lyxwidth; LyXLength lyxwidth;
/// ///
LyXLength lyxheight; LyXLength lyxheight;
/// Typ of rescaling the Screen /// Typ of rescaling the Screen inside lyx
int lyxscale; int lyxscale;
/// Typ of the LyXView, same as for latex
sizeType lyxsize_type;
/// ///
InsetGraphicsParams(); InsetGraphicsParams();
/// ///