diff --git a/lib/ChangeLog b/lib/ChangeLog index 6af785f3b7..a5c1f65cbf 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2002-01-27 Herbert Voss + + * help/Graphics.hlp: added, but not finished + 2002-01-26 Dekel Tsur * fonts-xlfd: diff --git a/lib/help/Graphics.hlp b/lib/help/Graphics.hlp new file mode 100644 index 0000000000..c5c0213fc4 --- /dev/null +++ b/lib/help/Graphics.hlp @@ -0,0 +1,8 @@ +@bFilename: + You do not need the extension like *eps, when your + config file of graphicx is present and has such + entries. +@bBounding Box: + The image size in Pixeln. Given through lower left + corner (x0,y0) and upper right corner (y1,y2) + diff --git a/src/ChangeLog b/src/ChangeLog index 734f252560..38b7be22ab 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2002-01-27 Herbert Voss + + * buffer.C: link old Figure to new graphic inset + 2002-01-26 Dekel Tsur * FontLoader.C (getFontinfo): Change the latex font names in order diff --git a/src/buffer.C b/src/buffer.C index 2e09363d36..3e6a4e3a2b 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -1513,8 +1513,8 @@ void Buffer::readInset(LyXLex & lex, Paragraph *& par, } else if (tmptok == "Formula") { inset = new InsetFormula; } else if (tmptok == "Figure") { // Backward compatibility - inset = new InsetFig(100, 100, *this); - //inset = new InsetGraphics; +// inset = new InsetFig(100, 100, *this); + inset = new InsetGraphics; } else if (tmptok == "Graphics") { inset = new InsetGraphics; } else if (tmptok == "Info") {// backwards compatibility diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index f33918b6ec..de95441ba3 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,8 @@ +2002-01-27 Herbert Voss + + * ControlGraphic.[Ch]: added support for Bounding Box, other + small changes + 2002-01-25 Angus Leeming * ControlAboutlyx.h: diff --git a/src/frontends/controllers/ControlGraphics.C b/src/frontends/controllers/ControlGraphics.C index a3675b159d..e7964cc3a1 100644 --- a/src/frontends/controllers/ControlGraphics.C +++ b/src/frontends/controllers/ControlGraphics.C @@ -9,9 +9,11 @@ * * \file ControlGraphics.C * \author Angus Leeming + * \author Herbert Voss */ #include +#include #ifdef __GNUG__ #pragma implementation @@ -31,12 +33,15 @@ #include "support/FileInfo.h" // for FileInfo #include "helper_funcs.h" // for browseFile +#include "support/lstrings.h" #include "support/filetools.h" // for AddName #include "BufferView.h" using std::pair; using std::make_pair; +using std::ifstream; + ControlGraphics::ControlGraphics(LyXView & lv, Dialogs & d) : ControlInset(lv, d) { @@ -80,7 +85,7 @@ string const ControlGraphics::Browse(string const & in_name) { string const title = N_("Graphics"); // FIXME: currently we need the second '|' to prevent mis-interpretation - string const pattern = "*.(ps|eps|png|jpeg|jpg|gif)|"; + string const pattern = "*.(ps|eps|png|jpeg|jpg|gif|gz)|"; // Does user clipart directory exist? string clipdir = AddName (user_lyxdir, "clipart"); @@ -93,3 +98,33 @@ string const ControlGraphics::Browse(string const & in_name) // Show the file browser dialog return browseFile(&lv_, in_name, title, pattern, dir1); } + +string const ControlGraphics::readBB(string const & file) +{ +// in a file it's an entry like %%BoundingBox:23 45 321 345 +// the first number can following without a space, so we have +// to check a bit more. +// ControlGraphics::bbChanged = false; + std::ifstream is(file.c_str()); + while (is) { + string s; + is >> s; + if (contains(s,"%%BoundingBox:")) { + string a, b, c, d; + is >> a >> b >> c >> d; + if (is) { + if (s != "%%BoundingBox:") + return (s.substr(14)+" "+a+" "+b+" "+c+" "); + else + return (a+" "+b+" "+c+" "+d+" "); + } + } + } + return string(); +} + +void ControlGraphics::help() const +{ + lv_.getDialogs()->showFile(i18nLibFileSearch("help","Graphics.hlp")); +} + diff --git a/src/frontends/controllers/ControlGraphics.h b/src/frontends/controllers/ControlGraphics.h index ba40f44bb1..0c9dc1696f 100644 --- a/src/frontends/controllers/ControlGraphics.h +++ b/src/frontends/controllers/ControlGraphics.h @@ -10,7 +10,8 @@ * * \file ControlGraphics.h * \author Angus Leeming - */ + * \author Herbert Voss +*/ #ifndef CONTROLGRAPHICS_H #define CONTROLGRAPHICS_H @@ -35,6 +36,12 @@ public: /// Browse for a file string const Browse(string const &); + /// Read the Bounding Box from a eps or ps-file + string const readBB(string const & file); + /// Control the bb + bool bbChanged; + /// Show Help file + void help() const; private: /// Dispatch the changed parameters to the kernel. @@ -48,3 +55,4 @@ private: }; #endif // CONTROLGRAPHICS_H + diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index af3136ed1d..590d44a465 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,13 @@ +2002-01-27 Herbert Voss + + * FormGraphic.[Ch]: + * form_graphic.[Ch]: + * forms/form_graphic.fd: rewritten to support graphicx with + all options and to be sure that the old figinsets are correct + converted. + * xforms-helpers.h: added two choice const for the LyXLength + one with all and one only with length which have a unit. + 2002-01-28 Angus Leeming * FormAboutlyx.[Ch]: Removed redundant form() method and diff --git a/src/frontends/xforms/FormGraphics.C b/src/frontends/xforms/FormGraphics.C index 936c19bdcd..81a51d3eb9 100644 --- a/src/frontends/xforms/FormGraphics.C +++ b/src/frontends/xforms/FormGraphics.C @@ -26,7 +26,8 @@ #include "input_validators.h" #include "debug.h" // for lyxerr #include "support/lstrings.h" // for strToDbl & tostr -#include "support/FileInfo.h" // for FileInfo +#include "support/FileInfo.h" +#include "support/filetools.h" // for MakeAbsPath etc #include "insets/insetgraphicsParams.h" #include "lyxrc.h" // for lyxrc.display_graphics @@ -34,22 +35,11 @@ using std::endl; namespace { -// Zero test for double precision numbers -double const tol = 1.0e-08; - -// The maximum digits for the image scale +// Bound the number of input characters int const SCALE_MAXDIGITS = 3; - -// The maximum digits for the image width int const WIDTH_MAXDIGITS = 3; - -// The maximum digits for the image height int const HEIGHT_MAXDIGITS = 3; - -// The max characters in the rotation angle (minus sign and 3 digits) int const ROTATE_MAXCHARS = 4; - -// The maximum characters in a filename. int const FILENAME_MAXCHARS = 1024; } // namespace anon @@ -62,63 +52,105 @@ FormGraphics::FormGraphics(ControlGraphics & c) {} +void FormGraphics::redraw() +{ + if(form() && form()->visible) + fl_redraw_form(form()); + else + return; + + FL_FORM * outer_form = fl_get_active_folder(dialog_->tabFolder); + if (outer_form && outer_form->visible) + fl_redraw_form(outer_form); +} + + void FormGraphics::build() { dialog_.reset(build_graphics()); - // This is the place to add settings of the dialog that did not go - // to the .fd file. - - // Set the input widgets to issue a callback to input() whenever - // they change, so we can verify their content. - fl_set_input_return (dialog_->input_filename, FL_RETURN_CHANGED); - fl_set_input_return (dialog_->input_scale, FL_RETURN_CHANGED); - fl_set_input_return (dialog_->input_width, FL_RETURN_CHANGED); - fl_set_input_return (dialog_->input_height, FL_RETURN_CHANGED); - fl_set_input_return (dialog_->input_rotate_angle, FL_RETURN_CHANGED); - fl_set_input_return (dialog_->input_subcaption, FL_RETURN_CHANGED); - - // Set the maximum characters that can be written in the input texts. - fl_set_input_maxchars(dialog_->input_scale, SCALE_MAXDIGITS); - fl_set_input_maxchars(dialog_->input_width, WIDTH_MAXDIGITS); - fl_set_input_maxchars(dialog_->input_height, HEIGHT_MAXDIGITS); - fl_set_input_maxchars(dialog_->input_filename, FILENAME_MAXCHARS); - fl_set_input_maxchars(dialog_->input_rotate_angle, ROTATE_MAXCHARS); - - // Set input filter on width and height to make them accept only - // unsigned numbers. - fl_set_input_filter(dialog_->input_scale, fl_unsigned_float_filter); - fl_set_input_filter(dialog_->input_width, fl_unsigned_float_filter); - fl_set_input_filter(dialog_->input_height, fl_unsigned_float_filter); - - // Set input filter on rotate_angle to make it accept only - // floating point numbers. - fl_set_input_filter(dialog_->input_rotate_angle, fl_float_filter); - - // Create the contents of the choices - string const width = " cm | inch | page %% | column %% "; - fl_addto_choice(dialog_->choice_width_units, width.c_str()); - - string const height = " cm | inch | page %% "; - fl_addto_choice(dialog_->choice_height_units, height.c_str()); - // Manage the ok, apply, restore and cancel/close buttons bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); +// bc().setApply(dialog_->button_apply); bc().setCancel(dialog_->button_cancel); bc().setRestore(dialog_->button_restore); - bc().addReadOnly(dialog_->input_filename); - bc().addReadOnly(dialog_->button_browse); - bc().addReadOnly(dialog_->check_display); - bc().addReadOnly(dialog_->input_scale); - bc().addReadOnly(dialog_->input_width); - bc().addReadOnly(dialog_->choice_width_units); - bc().addReadOnly(dialog_->input_height); - bc().addReadOnly(dialog_->choice_height_units); - bc().addReadOnly(dialog_->input_rotate_angle); - bc().addReadOnly(dialog_->input_subcaption); - bc().addReadOnly(dialog_->check_subcaption); + // the file section + file_.reset(build_file()); + + fl_set_input_return (file_->input_filename, FL_RETURN_CHANGED); + fl_set_input_return (file_->input_subcaption, FL_RETURN_CHANGED); + fl_set_input_return (file_->input_bbx0, FL_RETURN_CHANGED); + fl_set_input_return (file_->input_bby0, FL_RETURN_CHANGED); + fl_set_input_return (file_->input_bbx1, FL_RETURN_CHANGED); + fl_set_input_return (file_->input_bby1, FL_RETURN_CHANGED); + fl_set_input_maxchars(file_->input_filename, FILENAME_MAXCHARS); + + string const bb_units = "pt|cm|in"; + fl_addto_choice(file_->choice_bb_x0, bb_units.c_str()); + fl_addto_choice(file_->choice_bb_y0, bb_units.c_str()); + fl_addto_choice(file_->choice_bb_x1, bb_units.c_str()); + fl_addto_choice(file_->choice_bb_y1, bb_units.c_str()); + + bc().addReadOnly(file_->button_browse); + bc().addReadOnly(file_->check_subcaption); + bc().addReadOnly(file_->button_getBB); + bc().addReadOnly(file_->button_clip); + bc().addReadOnly(file_->button_draft); + + // the size section + size_.reset(build_size()); + + fl_set_input_return (size_->input_scale, FL_RETURN_CHANGED); + fl_set_input_return (size_->input_width, FL_RETURN_CHANGED); + fl_set_input_return (size_->input_height, FL_RETURN_CHANGED); + fl_set_input_return (size_->input_lyxwidth, FL_RETURN_CHANGED); + fl_set_input_return (size_->input_lyxheight, FL_RETURN_CHANGED); + + fl_set_input_maxchars(size_->input_scale, SCALE_MAXDIGITS); + fl_set_input_maxchars(size_->input_width, WIDTH_MAXDIGITS); + fl_set_input_maxchars(size_->input_height, HEIGHT_MAXDIGITS); + + fl_set_input_filter(size_->input_scale, fl_unsigned_float_filter); + fl_set_input_filter(size_->input_width, fl_unsigned_float_filter); + fl_set_input_filter(size_->input_height, fl_unsigned_float_filter); + + fl_addto_choice(size_->choice_width_units, choice_Length_All.c_str()); + fl_addto_choice(size_->choice_height_units, choice_Length_All.c_str()); + fl_addto_choice(size_->choice_width_lyxwidth, choice_Length_All.c_str()); + fl_addto_choice(size_->choice_width_lyxheight, choice_Length_All.c_str()); + + bc().addReadOnly(size_->button_default); + bc().addReadOnly(size_->button_wh); + bc().addReadOnly(size_->button_scale); + bc().addReadOnly(size_->check_aspectratio); + bc().addReadOnly(size_->radio_check_display); + bc().addReadOnly(size_->radio_display_mono); + bc().addReadOnly(size_->radio_display_gray); + bc().addReadOnly(size_->radio_display_color); + + // the rotate section + special_.reset(build_special()); + + fl_set_input_return (special_->input_rotate_angle, FL_RETURN_CHANGED); + + string const choice_origin = + "default|" // not important + "leftTop|leftBottom|leftBaseline|" // lt lb lB + "center|" // c + "centerTop|centerBottom|centerBaseline|" // ct cb cB + "rightTop|rightBottom|rightBaseline|" // rt rb rB + "referencePoint"; // special + fl_addto_choice(special_->choice_origin, choice_origin.c_str()); + + fl_set_input_return (special_->input_special, FL_RETURN_CHANGED); + fl_set_input_maxchars(special_->input_rotate_angle, ROTATE_MAXCHARS); + fl_set_input_filter(special_->input_rotate_angle, fl_float_filter); + + // add the different tabfolders + fl_addto_tabfolder(dialog_->tabFolder, _("Filename"), file_->form); + fl_addto_tabfolder(dialog_->tabFolder, _("Image size"), size_->form); + fl_addto_tabfolder(dialog_->tabFolder, _("Special"), special_->form); } @@ -126,87 +158,57 @@ void FormGraphics::apply() { // Create the parameters structure and fill the data from the dialog. InsetGraphicsParams & igp = controller().params(); - - igp.filename = fl_get_input(dialog_->input_filename); - - if (lyxrc.display_graphics == "no") { + igp.filename = getStringFromInput(file_->input_filename); + if (!controller().bbChanged) // different to the original one? + igp.bb = string(); // don't write anything + else { + string bb; + if (getStringFromInput(file_->input_bbx0).empty()) + bb = "0 "; + else + bb = getLengthFromWidgets(file_->input_bbx0,file_->choice_bb_x0)+" "; + if (getStringFromInput(file_->input_bby0).empty()) + bb += "0 "; + else + bb += (getLengthFromWidgets(file_->input_bby0,file_->choice_bb_y0)+" "); + if (getStringFromInput(file_->input_bbx1).empty()) + bb += "0 "; + else + bb += (getLengthFromWidgets(file_->input_bbx1,file_->choice_bb_x1)+" "); + if (getStringFromInput(file_->input_bby1).empty()) + bb += "0 "; + else + bb += (getLengthFromWidgets(file_->input_bby1,file_->choice_bb_y1)+" "); + igp.bb = bb; + } + igp.draft = fl_get_button(file_->button_draft); + igp.clip = fl_get_button(file_->button_clip); + igp.subcaption = fl_get_button(file_->check_subcaption); + igp.subcaptionText = getStringFromInput(file_->input_subcaption); + if (fl_get_button(size_->radio_check_display)) { igp.display = InsetGraphicsParams::NONE; - - } else { - if (fl_get_button(dialog_->check_display)) { - if (lyxrc.display_graphics == "mono") { - igp.display = InsetGraphicsParams::MONOCHROME; - } else if (lyxrc.display_graphics == "gray") { - igp.display = InsetGraphicsParams::GRAYSCALE; - } else if (lyxrc.display_graphics == "color") { - igp.display = InsetGraphicsParams::COLOR; - } - - } else { - igp.display = InsetGraphicsParams::NONE; - } + } else if (fl_get_button(size_->radio_display_mono)) { + igp.display = InsetGraphicsParams::MONOCHROME; + } else if (fl_get_button(size_->radio_display_gray)) { + igp.display = InsetGraphicsParams::GRAYSCALE; + } else if (fl_get_button(size_->radio_display_color)) { + igp.display = InsetGraphicsParams::COLOR; } + if (fl_get_button(size_->button_default)) + igp.size_type = InsetGraphicsParams::DEFAULT_SIZE; + else if (fl_get_button(size_->button_wh)) + igp.size_type = InsetGraphicsParams::WH; + else + igp.size_type = InsetGraphicsParams::SCALE; + igp.width = LyXLength(getLengthFromWidgets(size_->input_width,size_->choice_width_units)); + igp.height = LyXLength(getLengthFromWidgets(size_->input_height,size_->choice_height_units)); + igp.scale = strToInt(getStringFromInput(size_->input_scale)); + igp.keepAspectRatio = fl_get_button(size_->check_aspectratio); + igp.lyxwidth = LyXLength(getLengthFromWidgets(size_->input_lyxwidth,size_->choice_width_lyxwidth)); + igp.lyxheight = LyXLength(getLengthFromWidgets(size_->input_lyxheight,size_->choice_width_lyxheight)); - double const scale = - strToDbl(strip(fl_get_input(dialog_->input_scale))); - if (scale < tol) { - double const width = - strToDbl(strip(fl_get_input(dialog_->input_width))); - - if (width < tol) { - igp.widthResize = InsetGraphicsParams::DEFAULT_SIZE; - igp.widthSize = 0.0; - } else { - switch (fl_get_choice(dialog_->choice_width_units)) { - case 2: - igp.widthResize = InsetGraphicsParams::INCH; - break; - case 3: - igp.widthResize = - InsetGraphicsParams::PERCENT_PAGE; - break; - case 4: - igp.widthResize = - InsetGraphicsParams::PERCENT_COLUMN; - break; - default: - igp.widthResize = InsetGraphicsParams::CM; - break; - } - igp.widthSize = width; - } - - double const height = - strToDbl(strip(fl_get_input(dialog_->input_height))); - - if (height < tol) { - igp.heightResize = InsetGraphicsParams::DEFAULT_SIZE; - igp.heightSize = 0.0; - } else { - switch (fl_get_choice(dialog_->choice_height_units)) { - case 2: - igp.heightResize = InsetGraphicsParams::INCH; - break; - case 3: - igp.heightResize = - InsetGraphicsParams::PERCENT_PAGE; - break; - default: - igp.heightResize = InsetGraphicsParams::CM; - break; - } - igp.heightSize = height; - } - - } else { - igp.widthResize = InsetGraphicsParams::DEFAULT_SIZE; - igp.widthSize = 0.0; - igp.heightResize = InsetGraphicsParams::SCALE; - igp.heightSize = scale; - } - igp.rotateAngle = - strToDbl(strip(fl_get_input(dialog_->input_rotate_angle))); + strToDbl(getStringFromInput(special_->input_rotate_angle)); while (igp.rotateAngle < 0.0 || igp.rotateAngle > 360.0) { if (igp.rotateAngle < 0.0) { igp.rotateAngle += 360.0; @@ -214,155 +216,177 @@ void FormGraphics::apply() igp.rotateAngle -= 360.0; } } - - igp.subcaption = fl_get_button(dialog_->check_subcaption); - igp.subcaptionText = fl_get_input(dialog_->input_subcaption); - + if (fl_get_choice(special_->choice_origin) > 0) + igp.rotateOrigin = fl_get_choice_text(special_->choice_origin); + else + igp.rotateOrigin = string(); + igp.special = getStringFromInput(special_->input_special); igp.testInvariant(); } void FormGraphics::update() -{ +{ string unit = "cm"; + if (lyxrc.default_papersize < 3) + unit = "in"; + string const defaultUnit = string(unit); // Update dialog with details from inset InsetGraphicsParams & igp = controller().params(); - - // Update the filename input field - fl_set_input(dialog_->input_filename, - igp.filename.c_str()); - - // To display or not to display - if (lyxrc.display_graphics == "no") { - fl_set_button(dialog_->check_display, 0); - } else { - if (igp.display == InsetGraphicsParams::NONE) { - fl_set_button(dialog_->check_display, 0); - } else { - fl_set_button(dialog_->check_display, 1); - } + fl_set_input(file_->input_filename, igp.filename.c_str()); + // set the bounding box values, if exists. First we need the whole + // path, because the controller knows nothing about the doc-dir + lyxerr << "GraphicsUpdate::BoundingBox = " << igp.bb << "\n"; + controller().bbChanged = false; + if (igp.bb.empty()) { + string const fileWithAbsPath = MakeAbsPath(igp.filename, OnlyPath(igp.filename)); + string bb = controller().readBB(fileWithAbsPath); + lyxerr << "file::BoundingBox = " << bb << "\n"; + if (!bb.empty()) { + // get the values from the file + // in this case we always have the point-unit + fl_set_input(file_->input_bbx0, token(bb,' ',0).c_str()); + fl_set_input(file_->input_bby0, token(bb,' ',1).c_str()); + fl_set_input(file_->input_bbx1, token(bb,' ',2).c_str()); + fl_set_input(file_->input_bby1, token(bb,' ',3).c_str()); + } + } else { // get the values from the inset + controller().bbChanged = true; + LyXLength anyLength; + anyLength = LyXLength(token(igp.bb,' ',0)); + updateWidgetsFromLength(file_->input_bbx0,file_->choice_bb_x0,anyLength,"pt"); + anyLength = LyXLength(token(igp.bb,' ',1)); + updateWidgetsFromLength(file_->input_bby0,file_->choice_bb_y0,anyLength,"pt"); + anyLength = LyXLength(token(igp.bb,' ',2)); + updateWidgetsFromLength(file_->input_bbx1,file_->choice_bb_x1,anyLength,"pt"); + anyLength = LyXLength(token(igp.bb,' ',3)); + updateWidgetsFromLength(file_->input_bby1,file_->choice_bb_y1,anyLength,"pt"); } - - setEnabled(dialog_->check_display, (lyxrc.display_graphics != "no")); - - if (igp.heightResize == InsetGraphicsParams::SCALE) { - string number = tostr(igp.heightSize); - fl_set_input(dialog_->input_scale, number.c_str()); - fl_set_input(dialog_->input_width, ""); - fl_set_choice(dialog_->choice_width_units, 1); - fl_set_input(dialog_->input_height, ""); - fl_set_choice(dialog_->choice_height_units, 1); - - } else { - fl_set_input(dialog_->input_scale, ""); - - string number; - if (igp.widthResize != InsetGraphicsParams::DEFAULT_SIZE) { - number = tostr(igp.widthSize); - } - fl_set_input(dialog_->input_width, number.c_str()); - - int pos = 1; - //use inch as default with US papersizes in lyxrc - if (lyxrc.default_papersize < 3) - pos = 2; - switch (igp.widthResize) { - case InsetGraphicsParams::CM: - pos = 1; break; - - case InsetGraphicsParams::INCH: - pos = 2; break; - - case InsetGraphicsParams::PERCENT_PAGE: - pos = 3; break; - - case InsetGraphicsParams::PERCENT_COLUMN: - pos = 4; break; - - default: - break; - } - fl_set_choice(dialog_->choice_width_units, pos); - - number.erase(); - if (igp.heightResize != InsetGraphicsParams::DEFAULT_SIZE) { - number = tostr(igp.heightSize); - } - fl_set_input(dialog_->input_height, number.c_str()); - - pos = 1; - //use inch as default with US papersizes in lyxrc - if (lyxrc.default_papersize < 3) - pos = 2; - switch (igp.heightResize) { - case InsetGraphicsParams::CM: - pos = 1; break; - - case InsetGraphicsParams::INCH: - pos = 2; break; - - case InsetGraphicsParams::PERCENT_PAGE: - pos = 3; break; - - default: - break; - } - fl_set_choice(dialog_->choice_height_units, pos); - } - - // Update the rotate angle - fl_set_input(dialog_->input_rotate_angle, - tostr(igp.rotateAngle).c_str()); - + // Update the draft and clip mode + fl_set_button(file_->button_draft, igp.draft); + fl_set_button(file_->button_clip, igp.clip); // Update the subcaption check button and input field - fl_set_button(dialog_->check_subcaption, - igp.subcaption); - fl_set_input(dialog_->input_subcaption, - igp.subcaptionText.c_str()); - - setEnabled(dialog_->input_subcaption, - fl_get_button(dialog_->check_subcaption)); + fl_set_button(file_->check_subcaption, igp.subcaption); + fl_set_input(file_->input_subcaption, igp.subcaptionText.c_str()); + setEnabled(file_->input_subcaption, + fl_get_button(file_->check_subcaption)); + switch (igp.display) { + case InsetGraphicsParams::NONE: { // dont't display + fl_set_button(size_->radio_check_display, 1); + break; + } + case InsetGraphicsParams::MONOCHROME: { + fl_set_button(size_->radio_display_mono, 1); + break; + } + case InsetGraphicsParams::GRAYSCALE: { + fl_set_button(size_->radio_display_gray, 1); + break; + } + case InsetGraphicsParams::COLOR: { + fl_set_button(size_->radio_display_color, 1); + break; + } + } + updateWidgetsFromLength(size_->input_width,size_->choice_width_units,igp.width,defaultUnit); + updateWidgetsFromLength(size_->input_height,size_->choice_height_units,igp.height,defaultUnit); + fl_set_input(size_->input_scale, tostr(igp.scale).c_str()); + switch (igp.size_type) { + case InsetGraphicsParams::DEFAULT_SIZE: { + fl_set_button(size_->button_default,1); + setEnabled(size_->input_width, 0); + setEnabled(size_->choice_width_units, 0); + setEnabled(size_->input_height, 0); + setEnabled(size_->choice_height_units, 0); + setEnabled(size_->input_scale, 0); + break; + } + case InsetGraphicsParams::WH: { + fl_set_button(size_->button_wh, 1); + setEnabled(size_->input_width, 1); + setEnabled(size_->choice_width_units, 1); + setEnabled(size_->input_height, 1); + setEnabled(size_->choice_height_units, 1); + setEnabled(size_->input_scale, 0); + break; + } + case InsetGraphicsParams::SCALE: { + fl_set_button(size_->button_scale, 1); + setEnabled(size_->input_width, 0); + setEnabled(size_->choice_width_units, 0); + setEnabled(size_->input_height, 0); + setEnabled(size_->choice_height_units, 0); + setEnabled(size_->input_scale, 1); + break; + } + } + fl_set_button(size_->check_aspectratio,igp.keepAspectRatio); + // now the lyx-internally viewsize + updateWidgetsFromLength(size_->input_lyxwidth,size_->choice_width_lyxwidth,igp.lyxwidth,defaultUnit); + updateWidgetsFromLength(size_->input_lyxheight,size_->choice_width_lyxheight,igp.lyxheight,defaultUnit); + // Update the rotate angle and special commands + fl_set_input(special_->input_rotate_angle, + tostr(igp.rotateAngle).c_str()); + if (igp.rotateOrigin.empty()) + fl_set_choice(special_->choice_origin,0); + else + fl_set_choice_text(special_->choice_origin,igp.rotateOrigin.c_str()); + fl_set_input(special_->input_special, igp.special.c_str()); } ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long) { - if (ob == dialog_->button_browse) { + if (ob == file_->button_browse) { // Get the filename from the dialog - string const in_name = fl_get_input(dialog_->input_filename); + string const in_name = getStringFromInput(file_->input_filename); string const out_name = controller().Browse(in_name); - if (out_name != in_name && !out_name.empty()) { - fl_set_input(dialog_->input_filename, out_name.c_str()); + fl_set_input(file_->input_filename, out_name.c_str()); } - } - - if (ob == dialog_->input_scale) { - double const scale = - strToDbl(strip(fl_get_input(dialog_->input_scale))); - if (scale > tol) { - fl_set_input(dialog_->input_width, ""); - fl_set_choice(dialog_->choice_width_units, 1); - fl_set_input(dialog_->input_height, ""); - fl_set_choice(dialog_->choice_height_units, 1); + } else if (!controller().bbChanged && + ((ob == file_->input_bbx0) || (ob == file_->input_bby0) || + (ob == file_->input_bbx1) || (ob == file_->input_bby1) || + (ob == file_->choice_bb_x0) || (ob == file_->choice_bb_y0) || + (ob == file_->choice_bb_x1) || (ob == file_->choice_bb_y1))) { + controller().bbChanged = true; + } else if (ob == size_->button_default) { + setEnabled(size_->input_width, 0); + setEnabled(size_->choice_width_units, 0); + setEnabled(size_->input_height, 0); + setEnabled(size_->choice_height_units, 0); + setEnabled(size_->input_scale, 0); + } else if (ob == size_->button_wh) { + setEnabled(size_->input_width, 1); + setEnabled(size_->choice_width_units, 1); + setEnabled(size_->input_height, 1); + setEnabled(size_->choice_height_units, 1); + setEnabled(size_->input_scale, 0); + } else if (ob == size_->button_scale) { + setEnabled(size_->input_width, 0); + setEnabled(size_->choice_width_units, 0); + setEnabled(size_->input_height, 0); + setEnabled(size_->choice_height_units, 0); + setEnabled(size_->input_scale, 1); + } else if (ob == file_->check_subcaption) { + setEnabled(file_->input_subcaption, + fl_get_button(file_->check_subcaption)); + } else if (ob == file_->button_getBB) { + string const filename = getStringFromInput(file_->input_filename); + if (!filename.empty()) { + string const fileWithAbsPath = MakeAbsPath(filename, OnlyPath(filename)); + string bb = controller().readBB(fileWithAbsPath); + lyxerr << "getBB::BoundingBox = " << bb << "\n"; + if (!bb.empty()) { + fl_set_input(file_->input_bbx0, token(bb,' ',0).c_str()); + fl_set_input(file_->input_bby0, token(bb,' ',1).c_str()); + fl_set_input(file_->input_bbx1, token(bb,' ',2).c_str()); + fl_set_input(file_->input_bby1, token(bb,' ',3).c_str()); } + controller().bbChanged = false; + } + } else if (ob == dialog_->button_help) { + controller().help(); } - - if (ob == dialog_->input_width || ob == dialog_->input_height) { - double const width = - strToDbl(strip(fl_get_input(dialog_->input_width))); - double const height = - strToDbl(strip(fl_get_input(dialog_->input_height))); - - if (width > tol || height > tol) { - fl_set_input(dialog_->input_scale, ""); - } - } - - if (ob == dialog_->check_subcaption) { - setEnabled(dialog_->input_subcaption, - fl_get_button(dialog_->check_subcaption)); - } - return checkInput(); } @@ -372,20 +396,16 @@ ButtonPolicy::SMInput FormGraphics::checkInput() // Put verifications that the dialog shows some sane values, // if not disallow clicking on ok/apply. // Possibly use a label in the bottom of the dialog to give the reason. - ButtonPolicy::SMInput activate = ButtonPolicy::SMI_VALID; - // We verify now that there is a filename, it exists, it's a file // and it's readable. - string filename = fl_get_input(dialog_->input_filename); + string filename = getStringFromInput(file_->input_filename); FileInfo file(filename); - if (filename.empty() - || !file.isOK() - || !file.exist() - || !file.isRegular() - || !file.readable() + if (filename.empty() || !file.isOK() || !file.exist() + || !file.isRegular() || !file.readable() ) activate = ButtonPolicy::SMI_INVALID; return activate; } + diff --git a/src/frontends/xforms/FormGraphics.h b/src/frontends/xforms/FormGraphics.h index 0faa35eebe..211665bcce 100644 --- a/src/frontends/xforms/FormGraphics.h +++ b/src/frontends/xforms/FormGraphics.h @@ -10,11 +10,14 @@ * * \file FormGraphics.h * \author Baruch Even, baruch.even@writeme.com + * \author Herbert Voss, voss@lyx.org */ #ifndef FORMGRAPHICS_H #define FORMGRAPHICS_H +#include + #ifdef __GNUG__ #pragma interface #endif @@ -24,6 +27,9 @@ class ControlGraphics; struct FD_form_graphics; +struct FD_form_file; +struct FD_form_size; +struct FD_form_special; /** This class provides an XForms implementation of the Graphics Dialog. */ @@ -33,6 +39,10 @@ public: FormGraphics(ControlGraphics &); private: + + /** Redraw the form (on receipt of a Signal indicating, for example, + that the xforms colours have been re-mapped). */ + virtual void redraw(); /// Set the Params variable for the Controller. virtual void apply(); /// Build the dialog. @@ -41,13 +51,27 @@ private: virtual void update(); /// Filter the inputs on callback from xforms virtual ButtonPolicy::SMInput input(FL_OBJECT *, long); + /// + void help(); /// Verify that the input is correct. If not disable ok/apply buttons. ButtonPolicy::SMInput checkInput(); /// Fdesign generated method FD_form_graphics * build_graphics(); + /// + FD_form_file * build_file(); + /// + FD_form_size * build_size(); + /// + FD_form_special * build_special(); + + /// Real GUI implementation. + boost::scoped_ptr file_; + /// + boost::scoped_ptr size_; + /// + boost::scoped_ptr special_; }; - #endif // FORMGRAPHICS_H diff --git a/src/frontends/xforms/form_graphics.C b/src/frontends/xforms/form_graphics.C index 17c0778b3c..0f2bb4ddd8 100644 --- a/src/frontends/xforms/form_graphics.C +++ b/src/frontends/xforms/form_graphics.C @@ -22,103 +22,30 @@ FD_form_graphics * FormGraphics::build_graphics() FL_OBJECT *obj; FD_form_graphics *fdui = new FD_form_graphics; - fdui->form = fl_bgn_form(FL_NO_BOX, 490, 390); + fdui->form = fl_bgn_form(FL_NO_BOX, 510, 320); fdui->form->u_vdata = this; - obj = fl_add_box(FL_UP_BOX, 0, 0, 490, 390, ""); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); + obj = fl_add_box(FL_FLAT_BOX, 0, 0, 510, 320, ""); + fdui->tabFolder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 10, 5, 490, 270, _("Tabbed folder")); + fl_set_object_resize(obj, FL_RESIZE_ALL); { - char const * const dummy = N_("File|#F"); - fdui->input_filename = obj = fl_add_input(FL_NORMAL_INPUT, 90, 20, 270, 30, idex(_(dummy))); - fl_set_button_shortcut(obj, scex(_(dummy)), 1); - } - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - { - char const * const dummy = N_("Browse...|#B"); - fdui->button_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 370, 20, 100, 30, idex(_(dummy))); - fl_set_button_shortcut(obj, scex(_(dummy)), 1); - } - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 20, 70, 240, 140, _("Size")); - { - char const * const dummy = N_("Width|#W"); - fdui->input_width = obj = fl_add_input(FL_NORMAL_INPUT, 90, 80, 85, 30, idex(_(dummy))); + char const * const dummy = N_("Help|#H"); + fdui->button_help = obj = fl_add_button(FL_NORMAL_BUTTON, 440, 280, 60, 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_width_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 180, 80, 65, 30, ""); - fl_set_object_boxtype(obj, FL_FRAME_BOX); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - { - char const * const dummy = N_("Height|#H"); - fdui->input_height = obj = fl_add_input(FL_NORMAL_INPUT, 90, 120, 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); - fdui->choice_height_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 180, 120, 65, 30, ""); - fl_set_object_boxtype(obj, FL_FRAME_BOX); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - { - char const * const dummy = N_("Scale|#S"); - fdui->input_scale = obj = fl_add_input(FL_NORMAL_INPUT, 90, 170, 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); - // xgettext:no-c-format - obj = fl_add_text(FL_NORMAL_TEXT, 180, 170, 60, 30, _("%")); - fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 270, 70, 200, 70, _("Rotation")); - { - char const * const dummy = N_("Angle|#n"); - fdui->input_rotate_angle = obj = fl_add_input(FL_INT_INPUT, 340, 90, 70, 30, idex(_(dummy))); - fl_set_button_shortcut(obj, scex(_(dummy)), 1); - } - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - obj = fl_add_text(FL_NORMAL_TEXT, 410, 90, 50, 30, _("degs")); - fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 270, 160, 200, 50, _("Display Options")); - { - char const * const dummy = N_("Display in LyX|#D"); - fdui->check_display = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 400, 170, 30, 30, idex(_(dummy))); - fl_set_button_shortcut(obj, scex(_(dummy)), 1); - } - fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 20, 230, 450, 90, _("Subcaption")); - { - char const * const dummy = N_("Subcaption|#u"); - fdui->check_subcaption = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 110, 240, 30, 30, idex(_(dummy))); - fl_set_button_shortcut(obj, scex(_(dummy)), 1); - } - fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - { - char const * const dummy = N_("Title|#T"); - fdui->input_subcaption = obj = fl_add_input(FL_NORMAL_INPUT, 110, 280, 350, 30, idex(_(dummy))); - fl_set_button_shortcut(obj, scex(_(dummy)), 1); - } - fl_set_object_callback(obj, C_FormBaseInputCB, 0); { char const * const dummy = N_("Restore|#R"); - fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 20, 350, 100, 30, idex(_(dummy))); + fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 135, 280, 75, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest); fl_set_object_callback(obj, C_FormBaseRestoreCB, 0); - fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 180, 350, 90, 30, _("Ok")); + fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 280, 75, 30, _("Ok")); fl_set_object_callback(obj, C_FormBaseOKCB, 0); - { - char const * const dummy = N_("Apply|#A"); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 280, 350, 90, 30, idex(_(dummy))); - fl_set_button_shortcut(obj, scex(_(dummy)), 1); - } - fl_set_object_callback(obj, C_FormBaseApplyCB, 0); { char const * const dummy = N_("Cancel|^["); - fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 380, 350, 90, 30, idex(_(dummy))); + fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 260, 280, 75, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_callback(obj, C_FormBaseCancelCB, 0); @@ -130,3 +57,309 @@ FD_form_graphics * FormGraphics::build_graphics() } /*---------------------------------------*/ +FD_form_file::~FD_form_file() +{ + if ( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + +FD_form_file * FormGraphics::build_file() +{ + FL_OBJECT *obj; + FD_form_file *fdui = new FD_form_file; + + fdui->form = fl_bgn_form(FL_NO_BOX, 505, 235); + fdui->form->u_vdata = this; + obj = fl_add_box(FL_FLAT_BOX, 0, 0, 505, 235, ""); + { + char const * const dummy = N_("File|#F"); + fdui->input_filename = obj = fl_add_input(FL_NORMAL_INPUT, 85, 10, 270, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + { + char const * const dummy = N_("Browse...|#B"); + fdui->button_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 365, 10, 100, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 15, 50, 260, 115, _("Bounding Box")); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + { + char const * const dummy = N_("xLeftBottom|#x"); + fdui->input_bbx0 = obj = fl_add_input(FL_NORMAL_INPUT, 25, 75, 50, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + { + char const * const dummy = N_("yLeftBottom|#y"); + fdui->input_bby0 = obj = fl_add_input(FL_NORMAL_INPUT, 160, 75, 50, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + { + char const * const dummy = N_("xRightTop|#R"); + fdui->input_bbx1 = obj = fl_add_input(FL_NORMAL_INPUT, 25, 125, 50, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lalign(obj, FL_ALIGN_TOP); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + { + char const * const dummy = N_("yRightTop|#T"); + fdui->input_bby1 = obj = fl_add_input(FL_NORMAL_INPUT, 160, 125, 50, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + { + char const * const dummy = N_("clip to bounding box|#c"); + fdui->button_clip = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 290, 100, 30, 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_labelframe(FL_ENGRAVED_FRAME, 15, 165, 465, 60, _("Subfigure")); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + { + char const * const dummy = N_("On/Off|#O"); + fdui->check_subcaption = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 180, 30, 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); + { + char const * const dummy = N_("Title|#T"); + fdui->input_subcaption = obj = fl_add_input(FL_NORMAL_INPUT, 110, 185, 330, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lalign(obj, FL_ALIGN_TOP); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 285, 50, 195, 115, _("Options")); + { + char const * const dummy = N_("draft mode|#D"); + fdui->button_draft = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 290, 125, 30, 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); + fdui->choice_bb_x0 = obj = fl_add_choice(FL_NORMAL_CHOICE, 80, 75, 50, 30, ""); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fdui->choice_bb_y0 = obj = fl_add_choice(FL_NORMAL_CHOICE, 220, 75, 45, 30, ""); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fdui->choice_bb_x1 = obj = fl_add_choice(FL_NORMAL_CHOICE, 80, 125, 50, 30, ""); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fdui->choice_bb_y1 = obj = fl_add_choice(FL_NORMAL_CHOICE, 220, 125, 45, 30, ""); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + { + char const * const dummy = N_("Get BB from file|#G"); + fdui->button_getBB = obj = fl_add_button(FL_NORMAL_BUTTON, 295, 65, 170, 25, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_end_form(); + + fdui->form->fdui = fdui; + + return fdui; +} +/*---------------------------------------*/ + +FD_form_size::~FD_form_size() +{ + if ( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + +FD_form_size * FormGraphics::build_size() +{ + FL_OBJECT *obj; + FD_form_size *fdui = new FD_form_size; + + fdui->form = fl_bgn_form(FL_NO_BOX, 505, 235); + fdui->form->u_vdata = this; + obj = fl_add_box(FL_FLAT_BOX, 0, 0, 505, 235, ""); + obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 15, 10, 225, 30, _("LaTeX")); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + { + char const * const dummy = N_("Width|#W"); + fdui->input_width = obj = fl_add_input(FL_NORMAL_INPUT, 80, 80, 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); + fdui->choice_width_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 170, 80, 60, 30, ""); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + { + char const * const dummy = N_("Height|#H"); + fdui->input_height = obj = fl_add_input(FL_NORMAL_INPUT, 80, 120, 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); + fdui->choice_height_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 170, 120, 60, 30, ""); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + { + char const * const dummy = N_("Scale|#S"); + fdui->input_scale = obj = fl_add_input(FL_NORMAL_INPUT, 80, 185, 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); + // xgettext:no-c-format + obj = fl_add_text(FL_NORMAL_TEXT, 170, 185, 25, 30, _("%")); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 255, 10, 230, 215, _("LyX Screen")); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + { + char const * const dummy = N_("Width|#w"); + fdui->input_lyxwidth = obj = fl_add_input(FL_NORMAL_INPUT, 315, 145, 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); + fdui->choice_width_lyxwidth = obj = fl_add_choice(FL_NORMAL_CHOICE, 405, 145, 60, 30, ""); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + { + char const * const dummy = N_("Height|#h"); + fdui->input_lyxheight = obj = fl_add_input(FL_NORMAL_INPUT, 315, 185, 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); + fdui->choice_width_lyxheight = obj = fl_add_choice(FL_NORMAL_CHOICE, 405, 185, 60, 30, ""); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 15, 40, 225, 120, ""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 15, 160, 225, 65, ""); + + fdui->radio_display = fl_bgn_group(); + { + char const * const dummy = N_("Don't display|#D"); + fdui->radio_check_display = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 260, 20, 30, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_button(obj, 1); + { + char const * const dummy = N_("in Grayscale|#G"); + fdui->radio_display_gray = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 260, 75, 30, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + { + char const * const dummy = N_("in Color|#C"); + fdui->radio_display_color = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 260, 105, 30, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + { + char const * const dummy = N_("in Monochrome|#M"); + fdui->radio_display_mono = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 260, 45, 30, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_end_group(); + + + fdui->radio_size = fl_bgn_group(); + { + char const * const dummy = N_("Default|#D"); + fdui->button_default = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 15, 10, 30, 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); + { + char const * const dummy = N_("On/Off|#O"); + fdui->button_wh = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 15, 40, 30, 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); + { + char const * const dummy = N_("On/Off|#n"); + fdui->button_scale = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 15, 155, 30, 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); + fl_end_group(); + + { + char const * const dummy = N_("keep aspectratio|#k"); + fdui->check_aspectratio = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 100, 40, 30, 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); + fl_end_form(); + + fdui->form->fdui = fdui; + + return fdui; +} +/*---------------------------------------*/ + +FD_form_special::~FD_form_special() +{ + if ( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + +FD_form_special * FormGraphics::build_special() +{ + FL_OBJECT *obj; + FD_form_special *fdui = new FD_form_special; + + fdui->form = fl_bgn_form(FL_NO_BOX, 505, 235); + fdui->form->u_vdata = this; + obj = fl_add_box(FL_FLAT_BOX, 0, 0, 505, 235, ""); + obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 15, 15, 255, 65, _("Rotation")); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + { + char const * const dummy = N_("Angle|#n"); + fdui->input_rotate_angle = obj = fl_add_input(FL_INT_INPUT, 25, 40, 70, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + obj = fl_add_text(FL_NORMAL_TEXT, 100, 45, 45, 25, _("degrees")); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 275, 15, 205, 65, _("Special Options")); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + { + char const * const dummy = N_("Userdefined LaTeX-Options|#U"); + fdui->input_special = obj = fl_add_input(FL_NORMAL_INPUT, 285, 42, 180, 27, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + { + char const * const dummy = N_("Origin|#O"); + fdui->choice_origin = obj = fl_add_choice(FL_NORMAL_CHOICE2, 150, 40, 115, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_end_form(); + + fdui->form->fdui = fdui; + + return fdui; +} +/*---------------------------------------*/ + diff --git a/src/frontends/xforms/form_graphics.h b/src/frontends/xforms/form_graphics.h index a4c9c55318..c6a42a1aec 100644 --- a/src/frontends/xforms/form_graphics.h +++ b/src/frontends/xforms/form_graphics.h @@ -8,30 +8,77 @@ extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); extern "C" void C_FormBaseRestoreCB(FL_OBJECT *, long); extern "C" void C_FormBaseOKCB(FL_OBJECT *, long); -extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long); extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long); +extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); + +extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); + +extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); + /**** Forms and Objects ****/ struct FD_form_graphics { ~FD_form_graphics(); + FL_FORM *form; + FL_OBJECT *tabFolder; + FL_OBJECT *button_help; + FL_OBJECT *button_restore; + FL_OBJECT *button_ok; + FL_OBJECT *button_cancel; +}; +struct FD_form_file { + ~FD_form_file(); + FL_FORM *form; FL_OBJECT *input_filename; FL_OBJECT *button_browse; + FL_OBJECT *input_bbx0; + FL_OBJECT *input_bby0; + FL_OBJECT *input_bbx1; + FL_OBJECT *input_bby1; + FL_OBJECT *button_clip; + FL_OBJECT *check_subcaption; + FL_OBJECT *input_subcaption; + FL_OBJECT *button_draft; + FL_OBJECT *choice_bb_x0; + FL_OBJECT *choice_bb_y0; + FL_OBJECT *choice_bb_x1; + FL_OBJECT *choice_bb_y1; + FL_OBJECT *button_getBB; +}; +struct FD_form_size { + ~FD_form_size(); + + FL_FORM *form; FL_OBJECT *input_width; FL_OBJECT *choice_width_units; FL_OBJECT *input_height; FL_OBJECT *choice_height_units; FL_OBJECT *input_scale; + FL_OBJECT *input_lyxwidth; + FL_OBJECT *choice_width_lyxwidth; + FL_OBJECT *input_lyxheight; + FL_OBJECT *choice_width_lyxheight; + FL_OBJECT *radio_display; + FL_OBJECT *radio_check_display; + FL_OBJECT *radio_display_gray; + FL_OBJECT *radio_display_color; + FL_OBJECT *radio_display_mono; + FL_OBJECT *radio_size; + FL_OBJECT *button_default; + FL_OBJECT *button_wh; + FL_OBJECT *button_scale; + FL_OBJECT *check_aspectratio; +}; +struct FD_form_special { + ~FD_form_special(); + + FL_FORM *form; FL_OBJECT *input_rotate_angle; - FL_OBJECT *check_display; - FL_OBJECT *check_subcaption; - FL_OBJECT *input_subcaption; - FL_OBJECT *button_restore; - FL_OBJECT *button_ok; - FL_OBJECT *button_apply; - FL_OBJECT *button_cancel; + FL_OBJECT *input_special; + FL_OBJECT *choice_origin; }; #endif /* FD_form_graphics_h_ */ diff --git a/src/frontends/xforms/forms/form_graphics.fd b/src/frontends/xforms/forms/form_graphics.fd index 897c10ae02..e966747cb3 100644 --- a/src/frontends/xforms/forms/form_graphics.fd +++ b/src/frontends/xforms/forms/form_graphics.fd @@ -3,343 +3,74 @@ Magic: 13000 Internal Form Definition File (do not change) -Number of forms: 1 +Number of forms: 4 Unit of measure: FL_COORD_PIXEL +SnapGrid: 5 =============== FORM =============== Name: form_graphics -Width: 490 -Height: 390 -Number of Objects: 22 +Width: 510 +Height: 320 +Number of Objects: 6 -------------------- class: FL_BOX -type: UP_BOX -box: 0 0 490 390 +type: FLAT_BOX +box: 0 0 510 320 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_TABFOLDER +type: TOP_TABFOLDER +box: 10 5 490 270 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Tabbed folder +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: tabFolder +callback: +argument: + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 440 280 60 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: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NorthWest FL_SouthEast -name: -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 90 20 270 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: File|#F +label: Help|#H shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity -name: input_filename +name: button_help callback: C_FormBaseInputCB argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 370 20 100 30 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: Browse...|#B -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: button_browse -callback: C_FormBaseInputCB -argument: 0 - --------------------- -class: FL_LABELFRAME -type: ENGRAVED_FRAME -box: 20 70 240 140 -boxtype: FL_NO_BOX -colors: FL_BLACK FL_COL1 -alignment: FL_ALIGN_TOP_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: Size -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 90 80 85 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Width|#W -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: input_width -callback: C_FormBaseInputCB -argument: 0 - --------------------- -class: FL_CHOICE -type: NORMAL_CHOICE -box: 180 80 65 30 -boxtype: FL_FRAME_BOX -colors: FL_COL1 FL_BLACK -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: choice_width_units -callback: C_FormBaseInputCB -argument: 0 - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 90 120 85 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Height|#H -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: input_height -callback: C_FormBaseInputCB -argument: 0 - --------------------- -class: FL_CHOICE -type: NORMAL_CHOICE -box: 180 120 65 30 -boxtype: FL_FRAME_BOX -colors: FL_COL1 FL_BLACK -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: choice_height_units -callback: C_FormBaseInputCB -argument: 0 - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 90 170 85 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Scale|#S -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: input_scale -callback: C_FormBaseInputCB -argument: 0 - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 180 170 60 30 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: % -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_LABELFRAME -type: ENGRAVED_FRAME -box: 270 70 200 70 -boxtype: FL_NO_BOX -colors: FL_BLACK FL_COL1 -alignment: FL_ALIGN_TOP_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: Rotation -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_INPUT -type: INT_INPUT -box: 340 90 70 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: Angle|#n -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: input_rotate_angle -callback: C_FormBaseInputCB -argument: 0 - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 410 90 50 30 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: degs -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_LABELFRAME -type: ENGRAVED_FRAME -box: 270 160 200 50 -boxtype: FL_NO_BOX -colors: FL_BLACK FL_COL1 -alignment: FL_ALIGN_TOP_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: Display Options -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_CHECKBUTTON -type: PUSH_BUTTON -box: 400 170 30 30 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: Display in LyX|#D -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: check_display -callback: C_FormBaseInputCB -argument: 0 - --------------------- -class: FL_LABELFRAME -type: ENGRAVED_FRAME -box: 20 230 450 90 -boxtype: FL_NO_BOX -colors: FL_BLACK FL_COL1 -alignment: FL_ALIGN_TOP_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: Subcaption -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_CHECKBUTTON -type: PUSH_BUTTON -box: 110 240 30 30 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: Subcaption|#u -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: check_subcaption -callback: C_FormBaseInputCB -argument: 0 - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 110 280 350 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: Title|#T -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: input_subcaption -callback: C_FormBaseInputCB -argument: 0 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 20 350 100 30 +box: 135 280 75 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -357,7 +88,7 @@ argument: 0 -------------------- class: FL_BUTTON type: RETURN_BUTTON -box: 180 350 90 30 +box: 10 280 75 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -375,25 +106,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 280 350 90 30 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: Apply|#A -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: button_apply -callback: C_FormBaseApplyCB -argument: 0 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 380 350 90 30 +box: 260 280 75 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -408,5 +121,978 @@ name: button_cancel callback: C_FormBaseCancelCB argument: 0 +=============== FORM =============== +Name: form_file +Width: 505 +Height: 235 +Number of Objects: 19 + +-------------------- +class: FL_BOX +type: FLAT_BOX +box: 0 0 505 235 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 85 10 270 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_BOLD_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: File|#F +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_filename +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 365 10 100 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Browse...|#B +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_browse +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_LABELFRAME +type: ENGRAVED_FRAME +box: 15 50 260 115 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_BOLD_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Bounding Box +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 25 75 50 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: xLeftBottom|#x +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_bbx0 +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 160 75 50 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: yLeftBottom|#y +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_bby0 +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 25 125 50 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_TOP +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: xRightTop|#R +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_bbx1 +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 160 125 50 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: yRightTop|#T +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_bby1 +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHECKBUTTON +type: PUSH_BUTTON +box: 290 100 30 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_RIGHT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: clip to bounding box|#c +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_clip +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_LABELFRAME +type: ENGRAVED_FRAME +box: 15 165 465 60 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_BOLD_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Subfigure +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_CHECKBUTTON +type: PUSH_BUTTON +box: 15 180 30 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_RIGHT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: On/Off|#O +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: check_subcaption +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 110 185 330 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_TOP +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Title|#T +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_subcaption +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_LABELFRAME +type: ENGRAVED_FRAME +box: 285 50 195 115 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Options +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: 0 + +-------------------- +class: FL_CHECKBUTTON +type: PUSH_BUTTON +box: 290 125 30 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_RIGHT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: draft mode|#D +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_draft +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 80 75 50 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_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_CHOICE +type: NORMAL_CHOICE +box: 220 75 45 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_bb_y0 +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 80 125 50 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_bb_x1 +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 220 125 45 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_bb_y1 +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 295 65 170 25 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Get BB from file|#G +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_getBB +callback: C_FormBaseInputCB +argument: 0 + +=============== FORM =============== +Name: form_size +Width: 505 +Height: 235 +Number of Objects: 27 + +-------------------- +class: FL_BOX +type: FLAT_BOX +box: 0 0 505 235 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_LABELFRAME +type: ENGRAVED_FRAME +box: 15 10 225 30 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_BOLD_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: LaTeX +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 80 80 85 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Width|#W +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_width +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 170 80 60 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_width_units +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 80 120 85 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Height|#H +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_height +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 170 120 60 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_height_units +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 80 185 85 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Scale|#S +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_scale +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_TEXT +type: NORMAL_TEXT +box: 170 185 25 30 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: % +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_LABELFRAME +type: ENGRAVED_FRAME +box: 255 10 230 215 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_BOLD_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: LyX Screen +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 315 145 85 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Width|#w +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_lyxwidth +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 405 145 60 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_width_lyxwidth +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 315 185 85 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Height|#h +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_lyxheight +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 405 185 60 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_width_lyxheight +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_FRAME +type: ENGRAVED_FRAME +box: 15 40 225 120 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_FRAME +type: ENGRAVED_FRAME +box: 15 160 225 65 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_BEGIN_GROUP +type: 0 +box: 0 10 10 0 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_display +callback: +argument: + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 260 20 30 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Don't display|#D +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_check_display +callback: C_FormBaseInputCB +argument: 0 + value: 1 + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 260 75 30 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: in Grayscale|#G +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_display_gray +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 260 105 30 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: in Color|#C +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_display_color +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 260 45 30 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: in Monochrome|#M +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_display_mono +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_END_GROUP +type: 0 +box: 0 0 0 0 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_BEGIN_GROUP +type: 0 +box: 0 10 10 0 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_size +callback: +argument: + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 15 10 30 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_RIGHT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Default|#D +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_default +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 15 40 30 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_RIGHT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: On/Off|#O +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_wh +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 15 155 30 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_RIGHT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: On/Off|#n +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_scale +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_END_GROUP +type: 0 +box: 0 0 0 0 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_CHECKBUTTON +type: PUSH_BUTTON +box: 100 40 30 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_RIGHT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: keep aspectratio|#k +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: check_aspectratio +callback: C_FormBaseInputCB +argument: 0 + +=============== FORM =============== +Name: form_special +Width: 505 +Height: 235 +Number of Objects: 7 + +-------------------- +class: FL_BOX +type: FLAT_BOX +box: 0 0 505 235 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_LABELFRAME +type: ENGRAVED_FRAME +box: 15 15 255 65 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_BOLD_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Rotation +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_INPUT +type: INT_INPUT +box: 25 40 70 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Angle|#n +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_rotate_angle +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_TEXT +type: NORMAL_TEXT +box: 100 45 45 25 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: degrees +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_LABELFRAME +type: ENGRAVED_FRAME +box: 275 15 205 65 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_BOLD_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Special Options +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 285 42 180 27 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Userdefined LaTeX-Options|#U +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_special +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE2 +box: 150 40 115 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Origin|#O +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_origin +callback: C_FormBaseInputCB +argument: 0 + ============================== -create_the_forms +-------------------- diff --git a/src/frontends/xforms/xforms_helpers.h b/src/frontends/xforms/xforms_helpers.h index 490ab6e767..c4325d8801 100644 --- a/src/frontends/xforms/xforms_helpers.h +++ b/src/frontends/xforms/xforms_helpers.h @@ -16,6 +16,12 @@ class LyXLength; +// what we always need for lengths +string const choice_Length_All = + "cm|mm|in|%%|c%%|p%%|l%%|ex|em|pt|sp|bp|dd|pc|cc|mu"; +string const choice_Length_WithUnit = + "cm|mm|in|ex|em|pt|sp|bp|dd|pc|cc|mu"; // all with a Unit + /// Extract shortcut from | string char const * flyx_shortcut_extract(char const * sc); /// Shortcut for flyx_shortcut_extract diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index ad2b443b2d..781881e39c 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,3 +1,7 @@ +2002-01-27 Herbert Voss + + * GraphicsCacheItem.h: added Converting to the ImageStatus enum. + 2002-01-17 John Levon * ImageLoaderXPM.C: don't set XpmColorKey flag if we don't use it diff --git a/src/graphics/GraphicsCacheItem.h b/src/graphics/GraphicsCacheItem.h index 3895f3dafd..6264f3b784 100644 --- a/src/graphics/GraphicsCacheItem.h +++ b/src/graphics/GraphicsCacheItem.h @@ -41,6 +41,8 @@ public: /// Loading = 1, /// + Converting, + /// ErrorConverting, /// ErrorReading, diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 09174dab97..385dc37819 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,13 @@ +2002-01-27 Herbert Voss + + * insetgraphic.[Ch]: mostly newritten to support graphicx with + all options and to be sure that the old figinsets are correct + converted. + * insetgraphicParams.[Ch]: a lot of chamges to have a clean data- + structure and to support all lengths as LyXLength. The Parameter + structure changed again, but reading of "old" 1.2 graphic insets + is no problem. + 2002-01-20 Dekel Tsur * insetert.h (forceDefaultParagraphs): Added diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 4e19504f5a..5c2a21d561 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -3,22 +3,12 @@ * * LyX, The Document Processor * - * Copyright 1995-2001 the LyX Team. + * Copyright 1995-2002 the LyX Team. * - * This file Copyright 2000 Baruch Even. + * \author Baruch Even + * \author Herbert Voss * ====================================================== */ -/* -Major tasks: - * Switch to convert the images in the background, this requires work on - the converter, the systemcontroller and the graphics cache. - -Minor tasks: - * Pop up a dialog if the widget version is higher than what we accept. - * Provide sed/awk/C code to downgrade from InsetGraphics to FigInset(?) - -*/ - /* Known BUGS: @@ -47,10 +37,6 @@ Known BUGS: its original size and color, resizing is done in the final output, but not in the LyX window. - * The scale option is only handled for the horizontal part, the vertical - part will not work. For now it is also shown only for horizontal - resizing on the form. - * EPS figures are not fully detected, they may have a lot of possible suffixes so we need to read the file and detect if it's EPS or not. [Implemented, need testing] @@ -62,13 +48,6 @@ TODO Before initial production release: And act upon them. Make sure not to remove InsetFig code for the 1.2.0 release, only afterwards, after deployment shows InsetGraphics to be ok. - -TODO Extended features: - - * Advanced Latex tab folder. - * Add support for more features so that it will be better than insetfig. - * Keep aspect ratio radio button - * Support for complete control over the latex parameters for TeXperts * What advanced features the users want to do? Implement them in a non latex dependent way, but a logical way. LyX should translate it to latex or any other fitting format. @@ -83,43 +62,16 @@ TODO Extended features: * Add support for the 'picinpar' package. * Improve support for 'subfigure' - Allow to set the various options that are possible. - * Add resizing by percentage of image size (50%, 150%) - - usefull for two images of different size to be resized where - they both should have the same scale compared to each other. */ /* NOTES: - * - * Intentions: - * This is currently a moving target, I'm trying stuff and learning what - * is needed and how to accomplish it, since there is no predefined goal or - * way to go I invent it as I go. - * - * My current intention is for seperation from LaTeX, the basic needs are - * resizing and rotating, displaying on screen in various depths and printing - * conversion of depths (independent of the display depth). For this I'll - * provide a simple interface. - * - * The medium level includes clipping of the image, but in a limited way. - * - * For the LaTeX gurus I'll provide a complete control over the output, but - * this is latex dependent and guru dependent so I'd rather avoid doing this - * for the normal user. This stuff includes clipping, special image size - * specifications (\textwidth\minus 2in) which I see no way to generalize - * to non-latex specific way. - * - * Used packages: - * 'graphicx' for the graphics inclusion. - * 'subfigure' for the subfigures. - * * Fileformat: - * * Current version is 1 (inset file format version), when changing it * it should be changed in the Write() function when writing in one place * and when reading one should change the version check and the error message. - * * The filename is kept in the lyx file in a relative way, so as to allow * moving the document file and its images with no problem. + * * * Conversions: * Postscript output means EPS figures. @@ -155,6 +107,7 @@ TODO Extended features: #include "lyx_gui_misc.h" #include "support/FileInfo.h" #include "support/filetools.h" +#include "frontends/controllers/helper_funcs.h" #include "support/lyxlib.h" #include "lyxtext.h" #include "lyxrc.h" @@ -171,6 +124,9 @@ using std::ifstream; using std::ostream; using std::endl; +/////////////////////////////////////////////////////////////////////////// +int VersionNumber = 1; +/////////////////////////////////////////////////////////////////////////// // This function is a utility function // ... that should be with ChangeExtension ... @@ -209,31 +165,28 @@ 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; } } - return msg; } @@ -369,8 +322,7 @@ Inset::EDITABLE InsetGraphics::editable() const void InsetGraphics::write(Buffer const * buf, ostream & os) const { - os << "Graphics FormatVersion 1\n"; - + os << "Graphics FormatVersion " << VersionNumber << '\n'; params.Write(buf, os); } @@ -407,7 +359,7 @@ void InsetGraphics::readInsetGraphics(Buffer const * buf, LyXLex & lex) } else if (token == "FormatVersion") { lex.next(); int version = lex.getInteger(); - if (version > 1) + if (version > VersionNumber) lyxerr << "This document was created with a newer Graphics widget" ", You should use a newer version of LyX to read this" @@ -426,6 +378,8 @@ void InsetGraphics::readInsetGraphics(Buffer const * buf, LyXLex & lex) void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex) { + std::vector const oldUnits = + getVectorFromString("pt,cm,in,p%,c%"); bool finished = false; while (lex.isOK() && !finished) { @@ -450,6 +404,7 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex) } else if (token == "subcaption") { if (lex.eatLine()) params.subcaptionText = lex.getString(); + params.subcaption = true; } else if (token == "label") { if (lex.next()); // kept for backwards compability. Delete in 0.13.x @@ -457,14 +412,10 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex) if (lex.next()) params.rotateAngle = lex.getFloat(); } else if (token == "size") { - // Size of image on screen is ignored in InsetGraphics, just eat - // the input. - if (lex.next()) { - lex.getInteger(); - } - if (lex.next()) { - lex.getInteger(); - } + if (lex.next()) + params.lyxwidth = LyXLength(lex.getString()+"pt"); + if (lex.next()) + params.lyxheight = LyXLength(lex.getString()+"pt"); } else if (token == "flags") { InsetGraphicsParams::DisplayType tmp = InsetGraphicsParams::COLOR; if (lex.next()) @@ -476,78 +427,73 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex) } else if (token == "subfigure") { params.subcaption = true; } else if (token == "width") { + if (lex.next()) { + int i = lex.getInteger(); if (lex.next()) { - params.widthResize = static_cast(lex.getInteger()); - } - if (lex.next()) { - params.widthSize = lex.getFloat(); + if (i == 5) { + params.scale = lex.getInteger(); + params.size_type = InsetGraphicsParams::SCALE; + } else { + params.width = LyXLength(lex.getString()+oldUnits[i]); + params.size_type = InsetGraphicsParams::WH; + } } + } } else if (token == "height") { + if (lex.next()) { + int i = lex.getInteger(); if (lex.next()) { - params.heightResize = static_cast(lex.getInteger()); - } - if (lex.next()) { - params.heightSize = lex.getFloat(); + params.height = LyXLength(lex.getString()+oldUnits[i]); + params.size_type = InsetGraphicsParams::WH; } + } } } } - -namespace { - -void formatResize(ostream & os, string const & key, - InsetGraphicsParams::Resize resizeType, double size) -{ - switch (resizeType) { - case InsetGraphicsParams::DEFAULT_SIZE: - break; - - case InsetGraphicsParams::CM: - os << key << '=' << size << "cm,"; - break; - - case InsetGraphicsParams::INCH: - os << key << '=' << size << "in,"; - break; - - case InsetGraphicsParams::PERCENT_PAGE: - os << key << '=' << size / 100 << "\\text" << key << ','; - break; - - case InsetGraphicsParams::PERCENT_COLUMN: - os << key << '=' << size / 100 << "\\column" << key << ','; - break; - - case InsetGraphicsParams::SCALE: - os << "scale" << '=' << size/100 << ','; - } -} - -} // namespace anon - - -string const -InsetGraphics::createLatexOptions() const +string const InsetGraphics::createLatexOptions() const { // Calculate the options part of the command, we must do it to a string // stream since we might have a trailing comma that we would like to remove // before writing it to the output stream. ostringstream options; - - formatResize(options, "width", params.widthResize, params.widthSize); - formatResize(options, "height", params.heightResize, params.heightSize); - + if (!params.bb.empty()) + options << "bb=" << strip(params.bb) << ','; + if (params.draft) + options << "%\n draft,"; + if (params.clip) + options << "%\n clip,"; + if (params.size_type == InsetGraphicsParams::WH) { + if (!params.width.zero()) + options << "%\n width=" << params.width.asLatexString() << ','; + if (!params.height.zero()) + options << "%\n height=" << params.height.asLatexString() << ','; + } else if (params.size_type == InsetGraphicsParams::SCALE) { + if (params.scale > 0) + options << "%\n scale=" << double(params.scale)/100.0 << ','; + } + if (params.keepAspectRatio) + options << "%\n keepaspectratio,"; // Make sure it's not very close to zero, a float can be effectively // zero but not exactly zero. if (!lyx::float_equal(params.rotateAngle, 0, 0.001)) { - options << "angle=" - << params.rotateAngle << ','; + options << "%\n angle=" << params.rotateAngle << ','; + if (!params.rotateOrigin.empty()) { + options << "%\n origin="; + options << params.rotateOrigin[0]; + if (contains(params.rotateOrigin,"Top")) + options << 't'; + else if (contains(params.rotateOrigin,"Bottom")) + options << 'b'; + else if (contains(params.rotateOrigin,"Baseline")) + options << 'B'; + options << ','; + } } - + if (!params.special.empty()) + options << params.special << ','; string opts = options.str().c_str(); opts = strip(opts, ','); - return opts; } @@ -612,8 +558,7 @@ string decideOutputImageFormat(string const & suffix, enum FileType type) { // lyxrc.pdf_mode means: // Are we creating a PDF or a PS file? - // (Should actually mean, are we using latex or pdflatex). - + // (Should actually mean, are we using latex or pdflatex). if (lyxrc.pdf_mode) { if (type == EPS || type == EPS || type == PDF) return "pdf"; @@ -635,15 +580,12 @@ string decideOutputImageFormat(string const & suffix, enum FileType type) } // Anon. namespace -string const -InsetGraphics::prepareFile(Buffer const *buf) const +string const InsetGraphics::prepareFile(Buffer const *buf) const { - // do_convert = Do we need to convert the file? // nice = Do we create a nice version? // This is used when exporting the latex file only. // - // // if (!do_convert) // return original filename // @@ -680,9 +622,7 @@ InsetGraphics::prepareFile(Buffer const *buf) const string const relname = MakeRelPath(params.filename, path); outfile = RemoveExtension(relname); } - converters.convert(buf, params.filename, outfile, extension, image_target); - return outfile; } @@ -690,58 +630,36 @@ InsetGraphics::prepareFile(Buffer const *buf) const int InsetGraphics::latex(Buffer const *buf, ostream & os, bool /*fragile*/, bool/*fs*/) const { - // MISSING: We have to decide how to do the order of the options - // that is dependent of order, like width, height, angle. Should - // we rotate before scale? Should we let the user decide? - // bool rot_before_scale; ? - - // (BE) As a first step we should do a scale before rotate since this is - // more like the natural thought of how to do it. - // (BE) I believe that a priority list presented to the user with - // a default order would be the best, though it would be better to - // hide such a thing in an "Advanced options" dialog. - // (BE) This should go an advanced LaTeX options dialog. - // If there is no file specified, just output a message about it in // the latex output. if (params.filename.empty()) { os << "\\fbox{\\rule[-0.5in]{0pt}{1in}" - << _("empty figure path") - << "}\n"; - + << _("empty figure path") << "}\n"; return 1; // One end of line marker added to the stream. } - // Keep count of newlines that we issued. int newlines = 0; - // This variables collect all the latex code that should be before and // after the actual includegraphics command. string before; string after; - // Do we want subcaptions? if (params.subcaption) { before += "\\subfigure[" + params.subcaptionText + "]{"; after = '}' + after; } - // We never use the starred form, we use the "clip" option instead. os << before << "\\includegraphics"; - // Write the options if there are any. string const opts = createLatexOptions(); if (!opts.empty()) { - os << '[' << opts << ']'; + os << "[%\n " << opts << ']'; } - // Make the filename relative to the lyx file // and remove the extension so the LaTeX will use whatever is // appropriate (when there are several versions in different formats) string const filename = prepareFile(buf); - os << '{' << filename << '}' << after; - // Return how many newlines we issued. return newlines; } @@ -849,3 +767,4 @@ Inset * InsetGraphics::clone(Buffer const &, bool same_id) const { return new InsetGraphics(*this, same_id); } + diff --git a/src/insets/insetgraphics.h b/src/insets/insetgraphics.h index 6145bfe41c..6e00518c45 100644 --- a/src/insets/insetgraphics.h +++ b/src/insets/insetgraphics.h @@ -7,6 +7,8 @@ * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 the LyX Team. * + * \author Baruch Even + * \author Herbert Voss * ====================================================== */ #ifndef INSET_GRAPHICS_H diff --git a/src/insets/insetgraphicsParams.C b/src/insets/insetgraphicsParams.C index b99b52e070..5008d2ace3 100644 --- a/src/insets/insetgraphicsParams.C +++ b/src/insets/insetgraphicsParams.C @@ -5,7 +5,9 @@ * Copyright 1995 Matthias Ettrich. * Copyright 1995-2001 The LyX Team. * - * This file Copyright 2000 Baruch Even + * \author Baruch Even + * \author Herbert Voss + * * ================================================= */ #include @@ -29,63 +31,46 @@ namespace { /// translations. bool translatorsSet = false; -/// This is the translator between the Resize enum and corresponding lyx -/// file strings. -Translator< InsetGraphicsParams::Resize, string > -resizeTranslator(InsetGraphicsParams::DEFAULT_SIZE, "default"); - -/// This is the translator between the Origin enum and corresponding lyx -/// file strings. -Translator< InsetGraphicsParams::Origin, string > -originTranslator(InsetGraphicsParams::DEFAULT, "default"); - /// This is the translator between the Display enum and corresponding lyx /// file strings. Translator< InsetGraphicsParams::DisplayType, string > displayTranslator(InsetGraphicsParams::MONOCHROME, "monochrome"); +// this is only compatibility stuff for the first 1.2 version +// it is obselete until 1.3 +LyXLength convertResizeValue(string const token, LyXLex & lex) { + lex.next(); + string value = lex.getString(); // "width" or "height" + lex.next(); // anyway not interesting + value = lex.getString(); + if (token == "default") + return (LyXLength(value+"pt")); + else if (token == "cm") + return (LyXLength(value+"cm")); + else if (token == "inch") + return (LyXLength(value+"in")); + else if (token == "percentOfColumn") + return (LyXLength(value+"c%")); + else if (token == "percentOfPage") + return (LyXLength(value+"p%")); + else return LyXLength("0pt"); // nothing with figinset +} + } // namespace anon InsetGraphicsParams::InsetGraphicsParams() { init(); - // Set translators if (! translatorsSet) { translatorsSet = true; - - // Fill the resize translator - resizeTranslator.addPair(DEFAULT_SIZE, "default"); - resizeTranslator.addPair(CM, "cm"); - resizeTranslator.addPair(INCH, "inch"); - resizeTranslator.addPair(PERCENT_PAGE, "percentOfPage"); - resizeTranslator.addPair(PERCENT_COLUMN, "percentOfColumn"); - resizeTranslator.addPair(SCALE, "scale"); - - // Fill the origin translator - originTranslator.addPair(DEFAULT, "default"); - originTranslator.addPair(LEFTTOP, "leftTop"); - originTranslator.addPair(LEFTCENTER, "leftCenter"); - originTranslator.addPair(LEFTBASELINE, "leftBaseLine"); - originTranslator.addPair(LEFTBOTTOM, "leftBottom"); - originTranslator.addPair(CENTERTOP, "centerTop"); - originTranslator.addPair(CENTER, "center"); - originTranslator.addPair(CENTERBASELINE, "centerBaseLine"); - originTranslator.addPair(CENTERBOTTOM, "centerBottom"); - originTranslator.addPair(RIGHTTOP, "rightTop"); - originTranslator.addPair(RIGHTCENTER, "rightCenter"); - originTranslator.addPair(RIGHTBASELINE, "rightBaseLine"); - originTranslator.addPair(RIGHTBOTTOM, "rightBottom"); - originTranslator.addPair(REFERENCE_POINT, "referencePoint"); - // Fill the display translator displayTranslator.addPair(MONOCHROME, "monochrome"); displayTranslator.addPair(GRAYSCALE, "grayscale"); displayTranslator.addPair(COLOR, "color"); displayTranslator.addPair(NONE, "none"); } - } @@ -103,7 +88,6 @@ InsetGraphicsParams::operator=(InsetGraphicsParams const & params) // Are we assigning the object into itself? if (this == ¶ms) return * this; - copy(params); return *this; } @@ -111,15 +95,21 @@ InsetGraphicsParams::operator=(InsetGraphicsParams const & params) void InsetGraphicsParams::init() { subcaptionText = filename = string(); - display = MONOCHROME; - subcaption = false; - keepAspectRatio = true; - widthResize = DEFAULT_SIZE; - widthSize = 0.0; - heightResize = DEFAULT_SIZE; - heightSize = 0.0; - rotateOrigin = DEFAULT; - rotateAngle = 0.0; + bb = string(); // bounding box + draft = false; // draft mode + clip = false; // clip image + display = MONOCHROME; // LyX-View + subcaption = false; // subfigure + width = LyXLength(); // set to 0pt + height = LyXLength(); + lyxwidth = LyXLength(); // for the view in lyx + lyxheight = LyXLength(); + scale = 0; + size_type = DEFAULT_SIZE; + keepAspectRatio = false; + rotateOrigin = string(); // + rotateAngle = 0.0; // in degrees + special = string(); // userdefined stuff testInvariant(); } @@ -127,16 +117,22 @@ void InsetGraphicsParams::init() void InsetGraphicsParams::copy(InsetGraphicsParams const & igp) { filename = igp.filename; + bb = igp.bb; + draft = igp.draft; + clip = igp.clip; display = igp.display; subcaption = igp.subcaption; subcaptionText = igp.subcaptionText; keepAspectRatio = igp.keepAspectRatio; - widthResize = igp.widthResize; - widthSize = igp.widthSize; - heightResize = igp.heightResize; - heightSize = igp.heightSize; + width = igp.width; + height = igp.height; + scale = igp.scale; + size_type = igp.size_type; + lyxwidth = igp.lyxwidth; + lyxheight = igp.lyxheight; rotateOrigin = igp.rotateOrigin; rotateAngle = igp.rotateAngle; + special = igp.special; testInvariant(); } @@ -145,32 +141,11 @@ void InsetGraphicsParams::testInvariant() const { // Filename might be empty (when the dialog is first created). // Assert(!filename.empty()); - lyx::Assert(display == COLOR || display == MONOCHROME || display == GRAYSCALE || display == NONE ); - - lyx::Assert(widthResize == DEFAULT_SIZE || - widthResize == CM || - widthResize == INCH || - widthResize == PERCENT_PAGE || - widthResize == PERCENT_COLUMN || - widthResize == SCALE - ); - - lyx::Assert(heightResize == DEFAULT_SIZE || - heightResize == CM || - heightResize == INCH || - heightResize == PERCENT_PAGE || - heightResize == SCALE - ); - - // For SCALE these can be negative. - //lyx::Assert(widthSize >= 0.0); - //lyx::Assert(heightSize >= 0.0); - // Angle is in degrees and ranges -360 < angle < 360 // The reason for this is that in latex there is a meaning for the // different angles and they are not necessarliy interchangeable, @@ -184,16 +159,22 @@ bool operator==(InsetGraphicsParams const & left, InsetGraphicsParams const & right) { if (left.filename == right.filename && + left.bb == right.bb && + left.draft == right.draft && + left.clip == right.clip && left.display == right.display && left.subcaption == right.subcaption && left.subcaptionText == right.subcaptionText && left.keepAspectRatio == right.keepAspectRatio && - left.widthResize == right.widthResize && - left.widthSize == right.widthSize && - left.heightResize == right.heightResize && - left.heightSize == right.heightSize && + left.width == right.width && + left.height == right.height && + left.scale == right.scale && + left.size_type == right.size_type && + left.lyxwidth == right.lyxwidth && + left.lyxheight == right.lyxheight && left.rotateOrigin == right.rotateOrigin && - lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001) + lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 && + left.special == right.special) ) return true; @@ -207,96 +188,75 @@ bool operator!=(InsetGraphicsParams const & left, } -namespace { - -void writeResize(ostream & os, string const & key, - InsetGraphicsParams::Resize resize, double size) -{ - os << ' ' << key << "Resize "; - - os << resizeTranslator.find(resize); - os << ' ' << key << ' ' << size << '\n'; -} - -void writeOrigin(ostream & os, - InsetGraphicsParams::Origin origin) -{ - os << " rotateOrigin " << originTranslator.find(origin); - os << '\n'; -} - -} // namespace anon - - void InsetGraphicsParams::Write(Buffer const * buf, ostream & os) const { // If there is no filename, write nothing for it. if (! filename.empty()) { - os << "filename " + os << "\tfilename " << MakeRelPath(filename, buf->filePath()) << '\n'; } - + if (!bb.empty()) // bounding box + os << "\tBoundingBox " << bb << '\n'; + if (clip) // clip image + os << "\tclip\n"; + if (draft) // draft mode + os << "\tdraft\n"; // Save the display type - os << " display " << displayTranslator.find(display) << '\n'; - + os << "\tdisplay " << displayTranslator.find(display) << '\n'; // Save the subcaption status if (subcaption) - os << " subcaption"; - - if (! subcaptionText.empty()) - os << " subcaptionText \"" << subcaptionText << '\"' << '\n'; - - writeResize(os, "width", widthResize, widthSize); - writeResize(os, "height", heightResize, heightSize); - - writeOrigin(os, rotateOrigin); - if (!lyx::float_equal(rotateAngle, 0.0, 0.001)) { - os << " rotateAngle " << rotateAngle << '\n'; - } + os << "\tsubcaption\n"; + if (!subcaptionText.empty()) + os << "\tsubcaptionText \"" << subcaptionText << '\"' << '\n'; + // we always need the size type + // 0: no special + // 1: width/height combination + // 2: scale + os << "\tsize_type " << size_type << '\n'; + if (!width.zero()) + os << "\twidth " << width.asString() << '\n'; + if (!height.zero()) + os << "\theight " << height.asString() << '\n'; + if (scale != 0) + os << "\tscale " << scale << '\n'; + if (keepAspectRatio) + os << "\tkeepAspectRatio\n"; + if (!lyx::float_equal(rotateAngle, 0.0, 0.001)) + os << "\trotateAngle " << rotateAngle << '\n'; + if (!rotateOrigin.empty()) + os << "\trotateOrigin " << rotateOrigin << '\n'; + if (!special.empty()) + os << "\tspecial " << special << '\n'; + if (!lyxwidth.zero()) // the lyx-viewsize + os << "\tlyxwidth " << lyxwidth.asString() << '\n'; + if (!lyxheight.zero()) + os << "\tlyxheight " << lyxheight.asString(); } -namespace { - -void readResize(InsetGraphicsParams * igp, bool height, - string const & token) -{ - InsetGraphicsParams::Resize resize = InsetGraphicsParams::DEFAULT_SIZE; - - resize = resizeTranslator.find(token); - - if (height) - igp->heightResize = resize; - else - igp->widthResize = resize; -} - - -void readOrigin(InsetGraphicsParams * igp, string const & token) -{ - // TODO: complete this function. - igp->rotateOrigin = originTranslator.find(token); -} - -} // namespace anon - - bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex, string const& token) { if (token == "filename") { lex.next(); filename = lex.getString(); - if (!filename.empty()) { // Make the filename with absolute directory. filename = MakeAbsPath(filename, buf->filePath()); } + } else if (token == "BoundingBox") { + for (int i=0; i<4 ;i++) { + lex.next(); + bb += (lex.getString()+" "); + } + } else if (token == "clip") { + clip = true; + } else if (token == "draft") { + draft = true; } else if (token == "display") { lex.next(); string const type = lex.getString(); - display = displayTranslator.find(type); } else if (token == "subcaption") { subcaption = true; @@ -304,33 +264,55 @@ bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex, 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 == "size_type") { lex.next(); - string const token = lex.getString(); - - readResize(this, false, token); + switch (lex.getInteger()) { + case 0 : size_type = DEFAULT_SIZE; + break; + case 1 : size_type = WH; + break; + case 2 : size_type = SCALE; + } } else if (token == "width") { lex.next(); - widthSize = lex.getFloat(); + width = LyXLength(lex.getString()); + size_type = WH; } else if (token == "heightResize") { - lex.next(); - string const token = lex.getString(); - - readResize(this, true, token); + if (lex.next()) + height = convertResizeValue(lex.getString(), lex); } else if (token == "height") { lex.next(); - heightSize = lex.getFloat(); - } else if (token == "rotateOrigin") { - lex.next(); - string const token = lex.getString(); - - readOrigin(this, token); + height = LyXLength(lex.getString()); + size_type = WH; + } else if (token == "keepAspectRatio") { + keepAspectRatio = true; } else if (token == "rotateAngle") { lex.next(); rotateAngle = lex.getFloat(); + } else if (token == "rotateOrigin") { + lex.next(); + rotateOrigin=lex.getString(); + } else if (token == "lyxwidth") { + lex.next(); + lyxwidth = LyXLength(lex.getString()); + } else if (token == "lyxheight") { + lex.next(); + lyxheight = LyXLength(lex.getString()); } else { // If it's none of the above, its not ours. return false; } - return true; } diff --git a/src/insets/insetgraphicsParams.h b/src/insets/insetgraphicsParams.h index 601df89b0a..719aa22019 100644 --- a/src/insets/insetgraphicsParams.h +++ b/src/insets/insetgraphicsParams.h @@ -4,9 +4,10 @@ * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich. - * Copyright 1995-2001 The LyX Team. + * Copyright 1995-2002 The LyX Team. * - * This file Copyright 2000 Baruch Even + * \author Baruch Even + * \author Herbert Voss * ================================================= */ #ifndef INSETGRAPHICSPARAMS_H @@ -26,74 +27,50 @@ using std::ostream; /// This struct holds all the parameters needed by insetGraphics. struct InsetGraphicsParams { - /// Image filename. - string filename; - /// How do we display the image? enum DisplayType { - /// In full color range (if it's not in color we show it as it is) - COLOR, - /// In Grayscale (256 shades of gray). - GRAYSCALE, - /// In black and white. - MONOCHROME, - /// Don't display it on screen, only keep a frame in place. - NONE + COLOR, // full color range + GRAYSCALE, // 256 shades of gray + MONOCHROME, // In black and white. + NONE // only keep a frame in place. }; - - /// How to display the image - DisplayType display; - + enum sizeType { + DEFAULT_SIZE, // like none + WH, // width/height values + SCALE // percentage value + }; + /// Image filename. + string filename; /// Do we have a subcaption? bool subcaption; - /// The text of the subcaption. string subcaptionText; - - /// This is the different origins that the graphicx package support. - enum Origin { - DEFAULT, - LEFTTOP, - LEFTCENTER, - LEFTBASELINE, - LEFTBOTTOM, - CENTERTOP, - CENTER, - CENTERBASELINE, - CENTERBOTTOM, - RIGHTTOP, - RIGHTCENTER, - RIGHTBASELINE, - RIGHTBOTTOM, - REFERENCE_POINT = LEFTBASELINE - }; - - /** The resize of the image, is it the default size, in cm, inch or - percentage of the page/column width/height */ - enum Resize { - DEFAULT_SIZE, - CM, - INCH, - PERCENT_PAGE, - PERCENT_COLUMN, - SCALE - }; - - + /// The bounding box with "xLB yLB yRT yRT ", divided by a space! + 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 + LyXLength width; + /// + LyXLength height; + /// + int scale; + /// Type of rescaling + sizeType size_type; /// Keep the ratio between height and width when resizing. bool keepAspectRatio; - - /// What width resize to do? - Resize widthResize; - /// Value of width resize - float widthSize; - /// What height resize to do? - Resize heightResize; - /// Value of height resize - float heightSize; - + /// the size for the view inside lyx + LyXLength lyxwidth; + /// + LyXLength lyxheight; /// Origin point of rotation - Origin rotateOrigin; + string rotateOrigin; /// Rotation angle. float rotateAngle; /// @@ -102,20 +79,16 @@ struct InsetGraphicsParams InsetGraphicsParams(InsetGraphicsParams const &); /// InsetGraphicsParams & operator=(InsetGraphicsParams const &); - /// Save the parameters in the LyX format stream. void Write(Buffer const * buf, ostream & os) const; - /// If the token belongs to our parameters, read it. bool Read(Buffer const * buf, LyXLex & lex, string const & token); - /// Test the struct to make sure that all the options have legal values. void testInvariant() const; private: /// Initialize the object to a default status. void init(); - /// Copy the other objects content to us, used in copy c-tor and assignment void copy(InsetGraphicsParams const & params); };