]> git.lyx.org Git - features.git/commitdiff
Rob's patch and some minor cleanup
authorJohn Levon <levon@movementarian.org>
Sat, 24 Aug 2002 22:02:30 +0000 (22:02 +0000)
committerJohn Levon <levon@movementarian.org>
Sat, 24 Aug 2002 22:02:30 +0000 (22:02 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5092 a592a061-630c-0410-9148-cb99ea01b6c8

33 files changed:
src/ChangeLog
src/buffer.C
src/bufferlist.C
src/bufferview_funcs.C
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlGraphics.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/QGraphics.C
src/frontends/qt2/QLImage.C
src/frontends/qt2/lengthcombo.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormGraphics.C
src/frontends/xforms/FormGraphics.h
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/forms/form_graphics.fd
src/frontends/xforms/xformsImage.C
src/graphics/ChangeLog
src/graphics/GraphicsImage.C
src/graphics/GraphicsParams.C
src/graphics/GraphicsParams.h
src/graphics/GraphicsTypes.h
src/insets/insetfootlike.C
src/insets/insetgraphics.C
src/insets/insetgraphics.h
src/insets/insetgraphicsParams.C
src/insets/insetgraphicsParams.h
src/insets/insetminipage.C
src/lyxfont.C
src/lyxfunc.C
src/lyxlength.C
src/lyxlength.h
src/lyxrc.C
src/undo_funcs.C

index 7ba08609da5101982b722705265f0be771faf442..0255d4128e47a9b3a5f619cefa1d68c0836e4d61 100644 (file)
@@ -1,3 +1,21 @@
+2002-08-24  John Levon  <levon@movementarian.org>
+
+       * buffer.C:
+       * bufferlist.C:
+       * bufferview_funcs.C:
+       * lyxfont.C:
+       * undo_funcs.C: cleanups
+
+       * lyxfunc.C: disable CUT/COPY when no selection
+2002-08-23  Rob Lahaye  <lahaye@snu.ac.kr>
+       * lyxlength.[Ch]: use better (three letters) mnemonics for percentage units
+       in "enum UNIT"; e.g. PTW for Percent of TextWidth
+       
+       * lyxrc.C: graphics display is now monochrome|grayscale|color|none.
+       Add backward compatibility to "mono", "gray" and "no".
 2002-08-24  Dekel Tsur  <dekelts@tau.ac.il>
 
        * buffer.C (readFile): Always run lyx2lyx if file_format < LYX_FORMAT
index d53d3d672dbf90b539a428aaca5107f399cfef3e..7ca44140d41768b8e67df6c6e8ff7e28f09fd5da 100644 (file)
@@ -157,14 +157,7 @@ Buffer::Buffer(string const & file, bool ronly)
          filename_(file), users(0), ctrs(new Counters)
 {
        lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
-//     filename = file;
        filepath_ = OnlyPath(file);
-//     lyx_clean = true;
-//     bak_clean = true;
-//     dep_clean = 0;
-//     read_only = ronly;
-//     unnamed = false;
-//     users = 0;
        lyxvc.buffer(this);
        if (read_only || lyxrc.use_tempdir) {
                tmppath = CreateBufferTmpDir();
@@ -3217,20 +3210,21 @@ vector<pair<string, string> > const Buffer::getBibkeyList() const
                }
        }
 
+       if (!keys.empty())
+               return keys;
        // Might be either using bibtex or a child has bibliography
-       if (keys.empty()) {
-               for (inset_iterator it = inset_const_iterator_begin();
-                       it != inset_const_iterator_end(); ++it) {
-                       // Search for Bibtex or Include inset
-                       if (it->lyxCode() == Inset::BIBTEX_CODE) {
-                               vector<StringPair> tmp =
-                                       static_cast<InsetBibtex &>(*it).getKeys(this);
-                               keys.insert(keys.end(), tmp.begin(), tmp.end());
-                       } else if (it->lyxCode() == Inset::INCLUDE_CODE) {
-                               vector<StringPair> const tmp =
-                                       static_cast<InsetInclude &>(*it).getKeys();
-                               keys.insert(keys.end(), tmp.begin(), tmp.end());
-                       }
+       for (inset_iterator it = inset_const_iterator_begin();
+               it != inset_const_iterator_end(); ++it) {
+               // Search for Bibtex or Include inset
+               if (it->lyxCode() == Inset::BIBTEX_CODE) {
+                       vector<StringPair> tmp =
+                               static_cast<InsetBibtex &>(*it).getKeys(this);
+                       keys.insert(keys.end(), tmp.begin(), tmp.end());
+               } else if (it->lyxCode() == Inset::INCLUDE_CODE) {
+                       vector<StringPair> const tmp =
+                               static_cast<InsetInclude &>(*it).getKeys();
+                       keys.insert(keys.end(), tmp.begin(), tmp.end());
                }
        }
 
index d6a1058233d4aad0f78778982ef724f68a689b21..51e042724c84f111cb0fb1aa807cdd7589a420dc 100644 (file)
@@ -306,10 +306,10 @@ void BufferList::emergencyWrite(Buffer * buf)
        if (buf->isClean())
                return;
 
-       lyxerr << _("lyx: Attempting to save document ")
-              << (buf->isUnnamed() ? OnlyFilename(buf->fileName())
-                  : buf->fileName())
-              <<  _(" as...") << endl;
+       string const doc = buf->isUnnamed()
+               ? OnlyFilename(buf->fileName()) : buf->fileName();
+       lyxerr << _("LyX: Attempting to save document ") << doc << endl;
 
        // We try to save three places:
 
index 61f6a226dfe34bcd5377e0de99aa8afebddbc839..123ad1e70110b1e117db2648255c469d7ce413f3 100644 (file)
@@ -151,56 +151,55 @@ string const currentState(BufferView * bv)
 {
        ostringstream state;
 
-       if (bv->available()) {
-               // I think we should only show changes from the default
-               // font. (Asger)
-               LyXText * text = bv->getLyXText();
-               Buffer * buffer = bv->buffer();
-               LyXFont font = text->real_current_font;
-               LyXFont const & defaultfont =
-                       buffer->params.getLyXTextClass().defaultfont();
-               font.reduce(defaultfont);
-
-               state << _("Font:") << ' '
-                     << font.stateText(&buffer->params);
-
-               // The paragraph depth
-               int depth = text->getDepth();
-               if (depth > 0)
-                       state << _(", Depth: ") << depth;
-
-               // The paragraph spacing, but only if different from
-               // buffer spacing.
-               if (!text->cursor.par()->params().spacing().isDefault()) {
-                       Spacing::Space cur_space =
-                               text->cursor.par()->params().spacing().getSpace();
-                       state << _(", Spacing: ");
-
-                       switch (cur_space) {
-                       case Spacing::Single:
-                               state << _("Single");
-
-                               break;
-                       case Spacing::Onehalf:
-                               state << _("Onehalf");
-                               break;
-                       case Spacing::Double:
-                               state << _("Double");
-                               break;
-                       case Spacing::Other:
-                               state << _("Other (")
-                                     << text->cursor.par()->params().spacing().getValue()
-                                     << ")";
-                               break;
-                       case Spacing::Default:
-                               // should never happen, do nothing
-                               break;
-                       }
+       if (!bv->available())
+               return "";
+       // I think we should only show changes from the default
+       // font. (Asger)
+       LyXText * text = bv->getLyXText();
+       Buffer * buffer = bv->buffer();
+       LyXFont font = text->real_current_font;
+       LyXFont const & defaultfont =
+               buffer->params.getLyXTextClass().defaultfont();
+       font.reduce(defaultfont);
+
+       state << _("Font:") << ' ' << font.stateText(&buffer->params);
+
+       // The paragraph depth
+       int depth = text->getDepth();
+       if (depth > 0)
+               state << _(", Depth: ") << depth;
+
+       // The paragraph spacing, but only if different from
+       // buffer spacing.
+       if (!text->cursor.par()->params().spacing().isDefault()) {
+               Spacing::Space cur_space =
+                       text->cursor.par()->params().spacing().getSpace();
+               state << _(", Spacing: ");
+
+               switch (cur_space) {
+               case Spacing::Single:
+                       state << _("Single");
+                       break;
+               case Spacing::Onehalf:
+                       state << _("Onehalf");
+                       break;
+               case Spacing::Double:
+                       state << _("Double");
+                       break;
+               case Spacing::Other:
+                       state << _("Other (")
+                             << text->cursor.par()->params().spacing().getValue()
+                             << ")";
+                       break;
+               case Spacing::Default:
+                       // should never happen, do nothing
+                       break;
                }
+       }
 #ifdef DEVEL_VERSION
-               state << _(", Paragraph: ") << text->cursor.par()->id();
+       state << _(", Paragraph: ") << text->cursor.par()->id();
 #endif
-       }
        return state.str().c_str();
 }
 
index 0c1f6aa44ce3d3ae92be804c9a91e4fe1c63347d..3bfff59d44698047b38ecf5f65f3dfcdf3893dc9 100644 (file)
@@ -1,3 +1,8 @@
+2002-08-23  Rob Lahaye  <lahaye@snu.ac.kr>
+
+       * ControlGraphics.C: make rotationOrigin's default ("leftBaseline") the
+       first item in the list
+
 2002-08-15  Angus Leeming  <leeming@lyx.org>
 
        * ControlConnections.C: Dialogs::redrawGUI is now a method not a signal.
index 1a35ff0a934a7e86aae29bdc1eabaaf207f8982a..d41e92e5ae239666c539dd26bce62f45183811a8 100644 (file)
@@ -145,18 +145,16 @@ namespace {
 // end of each line.
 char const * const rorigin_lyx_strs[] = {
        // the LaTeX default is leftBaseline
-       "center",                                        // c
-       "leftTop",   "leftBottom",   "leftBaseline",     // lt lb lB
-       "centerTop", "centerBottom", "centerBaseline",   // ct cb cB
-       "rightTop",  "rightBottom",  "rightBaseline" };  // rt rb rB
+       "leftBaseline",   "leftTop",   "leftBottom",             // lB lt lb
+       "center", "centerBaseline", "centerTop", "centerBottom", // c cB ct cb
+       "rightBaseline",  "rightTop",  "rightBottom"  };         // rt rb rB
 
 // These are the strings, corresponding to the above, that the GUI should
 // use. Note that they can/should be translated.
 char const * const rorigin_gui_strs[] = {
-       N_("center"),
-       N_("left top"),   N_("left bottom"),   N_("left baseline"),
-       N_("center top"), N_("center bottom"), N_("center baseline"),
-       N_("right top"),  N_("right bottom"),  N_("right baseline") };
+       N_("left baseline"), N_("left top"), N_("left bottom"),
+       N_("center"), N_("center baseline"), N_("center top"), N_("center bottom"),
+       N_("right baseline"), N_("right top"),  N_("right bottom") };
 
 size_t const rorigin_size = sizeof(rorigin_lyx_strs) / sizeof(char *);
 
index 4fba775304ab03d45f420d62ef0e227b6b7e23d1..134ea18cdaf2fefd9572354574e718e5b525cd13 100644 (file)
@@ -1,3 +1,11 @@
+2002-08-23  Rob Lahaye  <lahaye@snu.ac.kr>
+
+       * lengthcombo.C: apply changes to "enum UNIT" in src/lyxlength.h
+
+       * QLImage.C:
+       * QGraphics.C: Implement changes for new xforms graphics dialog
+       (NB: Qt Graphics dialog itself is NOT YET updated!).
+
 2002-08-15  Angus Leeming  <leeming@lyx.org>
 
        * lyx_gui.C (hexname): enable previews to work!
index fe380c55e41e68d309da6cb25eb0cbb310883216..99d0263424ddca3950c073ce47412b575e5767da 100644 (file)
@@ -71,9 +71,21 @@ void QGraphics::update_contents()
 {
        InsetGraphicsParams & igp = controller().params();
 
+       // set the right default unit
        string unit = "cm";
-       if (lyxrc.default_papersize < 3)
-           unit = "in";
+       switch (lyxrc.default_papersize) {
+               case BufferParams::PAPER_DEFAULT: break;
+       
+               case BufferParams::PAPER_USLETTER:
+               case BufferParams::PAPER_LEGALPAPER:
+               case BufferParams::PAPER_EXECUTIVEPAPER: unit = "in"; break;
+       
+               case BufferParams::PAPER_A3PAPER:
+               case BufferParams::PAPER_A4PAPER:
+               case BufferParams::PAPER_A5PAPER:
+               case BufferParams::PAPER_B5PAPER: unit = "cm"; break;
+       }
+       // ?? defaultUnit is not used !!
        string const defaultUnit = string(unit);
 
        // Update dialog with details from inset
@@ -112,42 +124,18 @@ void QGraphics::update_contents()
 
        int item;
        switch (igp.display) {
-               case InsetGraphicsParams::DEFAULT: item = 0; break;
-               case InsetGraphicsParams::MONOCHROME: item = 1; break;
-               case InsetGraphicsParams::GRAYSCALE: item = 2; break;
-               case InsetGraphicsParams::COLOR: item = 3; break;
-               case InsetGraphicsParams::NONE: item = 4; break;
+               case grfx::DefaultDisplay: item = 0; break;
+               case grfx::MonochromeDisplay: item = 1; break;
+               case grfx::GrayscaleDisplay: item = 2; break;
+               case grfx::ColorDisplay: item = 3; break;
+               case grfx::NoDisplay: item = 4; break;
        }
        dialog_->show->setCurrentItem(item);
 
-       QRadioButton * b;
-       switch (igp.lyxsize_kind) {
-               case InsetGraphicsParams::DEFAULT_SIZE: b = dialog_->displaydefaultRB; break;
-               case InsetGraphicsParams::WH: b = dialog_->displaycustomRB; break;
-               case InsetGraphicsParams::SCALE: b = dialog_->displayscaleRB; break;
-       }
-       b->setChecked(true);
-       dialog_->displaywidthUnit->setCurrentItem(igp.lyxwidth.unit());
-       dialog_->displayheightUnit->setCurrentItem(igp.lyxheight.unit());
-       dialog_->displaywidth->setText(tostr(igp.lyxwidth.value()).c_str());
-       dialog_->displayheight->setText(tostr(igp.lyxheight.value()).c_str());
        dialog_->displayscale->setText(tostr(igp.lyxscale).c_str());
-       dialog_->displayratioCB->setChecked(igp.keepLyXAspectRatio);
 
-       switch (igp.size_kind) {
-               case InsetGraphicsParams::DEFAULT_SIZE: b = dialog_->defaultRB; break;
-               case InsetGraphicsParams::WH: b = dialog_->customRB; break;
-               case InsetGraphicsParams::SCALE: b = dialog_->scaleRB; break;
-       }
-       b->setChecked(true);
-       
        dialog_->widthUnit->setCurrentItem(igp.width.unit());
        dialog_->heightUnit->setCurrentItem(igp.height.unit());
-       dialog_->width->setText(tostr(igp.width.value()).c_str());
-       dialog_->height->setText(tostr(igp.height.value()).c_str());
-       dialog_->scale->setText(tostr(igp.scale).c_str());
        dialog_->aspectratio->setChecked(igp.keepAspectRatio);
 
        // Update the rotate angle
@@ -205,61 +193,32 @@ void QGraphics::apply()
        igp.subcaptionText = dialog_->subcaption->text();
 
        switch (dialog_->show->currentItem()) {
-               case 0: igp.display = InsetGraphicsParams::DEFAULT; break;
-               case 1: igp.display = InsetGraphicsParams::MONOCHROME; break;
-               case 2: igp.display = InsetGraphicsParams::GRAYSCALE; break;
-               case 3: igp.display = InsetGraphicsParams::COLOR; break;
-               case 4: igp.display = InsetGraphicsParams::NONE; break;
+               case 0: igp.display = grfx::DefaultDisplay; break;
+               case 1: igp.display = grfx::MonochromeDisplay; break;
+               case 2: igp.display = grfx::GrayscaleDisplay; break;
+               case 3: igp.display = grfx::ColorDisplay; break;
+               case 4: igp.display = grfx::NoDisplay; break;
                default:;
        }
 
-       if (dialog_->defaultRB->isChecked())
-           igp.size_kind = InsetGraphicsParams::DEFAULT_SIZE;
-       else if (dialog_->customRB->isChecked())
-           igp.size_kind = InsetGraphicsParams::WH;
-       else
-           igp.size_kind = InsetGraphicsParams::SCALE;
-
        string value(dialog_->width->text());
        igp.width = LyXLength(strToDbl(value), dialog_->widthUnit->currentLengthItem());
        value = string(dialog_->height->text());
        igp.height = LyXLength(strToDbl(value), dialog_->heightUnit->currentLengthItem());
 
-       igp.scale = strToInt(string(dialog_->scale->text()));
        igp.keepAspectRatio = dialog_->aspectratio->isChecked();
  
-       if (dialog_->displaydefaultRB->isChecked())
-           igp.lyxsize_kind = InsetGraphicsParams::DEFAULT_SIZE;
-       else if (dialog_->displaycustomRB->isChecked())
-           igp.lyxsize_kind = InsetGraphicsParams::WH;
-       else
-           igp.lyxsize_kind = InsetGraphicsParams::SCALE;
-
-       value = string(dialog_->displaywidth->text());
-       igp.lyxwidth = LyXLength(strToDbl(value), dialog_->displaywidthUnit->currentLengthItem());
-       value = string(dialog_->displayheight->text());
-       igp.lyxheight = LyXLength(strToDbl(value), dialog_->displayheightUnit->currentLengthItem());
-
        igp.lyxscale = strToInt(string(dialog_->displayscale->text()));
-       igp.keepLyXAspectRatio = dialog_->displayratioCB->isChecked();
 
        igp.rotateAngle = strToDbl(string(dialog_->angle->text()));
-
-       while (igp.rotateAngle < 0.0 || igp.rotateAngle > 360.0) {
-               if (igp.rotateAngle < 0.0) {
-                       igp.rotateAngle += 360.0;
-               } else if (igp.rotateAngle > 360.0) {
-                       igp.rotateAngle -= 360.0;
-               }
-       }
+       while (igp.rotateAngle < -360.0) igp.rotateAngle += 360.0;
+       while (igp.rotateAngle >  360.0) igp.rotateAngle -= 360.0;
 
        if ((dialog_->origin->currentItem()) > 0)
                igp.rotateOrigin = dialog_->origin->currentText();
        else
            igp.rotateOrigin = string();
 
-       igp.rotate = igp.rotateAngle != 0.0;
-        
        igp.special = dialog_->latexoptions->text();
 }
 
index 6b8a3a092eae64a95ad3899af93aa7a7dd80a180..7ff7a00f62365a1f41822932d6c19dcfafa8bed4 100644 (file)
@@ -214,8 +214,8 @@ void QLImage::clip(Params const & params)
        if (new_width == pixmap_.width() && new_height == pixmap_.height())
                return;
 
-       int const xoffset_l = std::max(0, params.bb.xl);
-       int const yoffset_t = std::max(0, pixmap_.height() - params.bb.yt);
+       int const xoffset_l = std::max(0, int(params.bb.xl));
+       int const yoffset_t = std::max(0, pixmap_.height() - int(params.bb.yt));
 
        xformed_pixmap_.resize(new_width, new_height);
        QPainter p;
index 3162712fdfff24bcaaee0fb22ba40ed20df45801..fb4866af8f211edc501c9701b188f58bf89b57fa 100644 (file)
@@ -58,10 +58,10 @@ LyXLength::UNIT LengthCombo::currentLengthItem() const
                case 9: unit = LyXLength::DD; break;
                case 10: unit = LyXLength::CC; break;
                case 11: unit = LyXLength::MU; break;
-               case 12: unit = LyXLength::PP; break;
-               case 13: unit = LyXLength::PW; break;
-               case 14: unit = LyXLength::PL; break;
-               // FIXME: LyXLength::PE ?
+               case 12: unit = LyXLength::PPW; break;
+               case 13: unit = LyXLength::PCW; break;
+               case 14: unit = LyXLength::PLW; break;
+               // FIXME: LyXLength::PTW ?
        };
        return unit;
 }
@@ -90,10 +90,10 @@ void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
                case LyXLength::DD: i = 9; break;
                case LyXLength::CC: i = 10; break;
                case LyXLength::MU: i = 11; break;
-               case LyXLength::PP: i = 12; break;
-               case LyXLength::PW: i = 13; break;
-               case LyXLength::PL: i = 14; break;
-               // FIXME: LyXLength::PE ?
+               case LyXLength::PPW: i = 12; break;
+               case LyXLength::PCW: i = 13; break;
+               case LyXLength::PLW: i = 14; break;
+               // FIXME: LyXLength::PTW ?
        }
        QComboBox::setCurrentItem(i);
 }
index f5a9e77e5074c10a82afcf4d5986e93b206eb0ca..dce80b7369ff4a4f4cfce3673bb7a94cd6322683 100644 (file)
@@ -1,6 +1,18 @@
+2002-08-24  John Levon  <levon@movementarian.org>
+
+       * xformsImage.C: fix build, add FIXME for Rob
+2002-08-23  Rob Lahaye  <lahaye@snu.ac.kr>
+
+       * FormGraphics.[Ch]:
+       * forms/form_graphics.fd: Implement new graphics dialog
+       
+       * FormPreferences.C: use display_graphics "monochrome|grayscale|none"
+       instead of "mono|gray|no".
+
 2002-08-22  John Levon  <levon@movementarian.org>
 
-       * fontloader.C: show name of failed font load (from Mikhail Teterin)
+       * xfont_loader.C: show name of failed font load (from Mikhail Teterin)
  
 2002-08-20  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
index 231c07707b1ea93b2b0658e5eed129d1a6748449..ed4469a3ad4eaf2c867be501489082fa2cdcb4fb 100644 (file)
@@ -36,11 +36,8 @@ using std::vector;
 namespace {
 
 // Bound the number of input characters
-int const SCALE_MAXDIGITS = 3;         // %-value
-int const WIDTH_MAXDIGITS = 10;
-int const HEIGHT_MAXDIGITS = 10;
-int const ROTATE_MAXCHARS = 5;         // like 270.1
 int const FILENAME_MAXCHARS = 1024;
+
 string defaultUnit("cm");
 
 /// Given input and choice widgets, create a LyXLength
@@ -88,29 +85,28 @@ void FormGraphics::build()
        file_.reset(build_graphics_file(this));
 
        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_rotate_angle, FL_RETURN_CHANGED);
-       fl_set_input_maxchars(file_->input_filename,  FILENAME_MAXCHARS);
-       fl_set_input_maxchars(file_->input_rotate_angle, ROTATE_MAXCHARS);
-       fl_set_input_filter(file_->input_rotate_angle, fl_float_filter);
+       fl_set_input_return (file_->input_lyxscale, FL_RETURN_CHANGED);
+       fl_set_input_return (file_->input_width, FL_RETURN_CHANGED);
+       fl_set_input_return (file_->input_height, FL_RETURN_CHANGED);
 
        setPrehandler(file_->input_filename);
-       setPrehandler(file_->input_subcaption);
-       setPrehandler(file_->input_rotate_angle);
+       setPrehandler(file_->input_lyxscale);
+       setPrehandler(file_->input_width);
+       setPrehandler(file_->input_height);
 
-       using namespace frnt;
-       vector<RotationOriginPair> origindata = getRotationOriginData();
+       fl_set_input_maxchars(file_->input_filename, FILENAME_MAXCHARS);
+       fl_set_input_filter(file_->input_lyxscale, fl_unsigned_int_filter);
 
-       // Store the identifiers for later
-       origins_ = getSecond(origindata);
+        // width default is scaling, thus unsigned integer input
+       fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
+       fl_set_input_filter(file_->input_height, fl_unsigned_float_filter);
 
-       string const choice =
-               " " + getStringFromVector(getFirst(origindata), " | ") +" ";
-       fl_addto_choice(file_->choice_origin, choice.c_str());
+       fl_addto_choice(file_->choice_display, _("Default|Monochrome|Grayscale|Color|Do not display")); 
+       fl_addto_choice(file_->choice_width, (_("Scale%%|") + choice_Length_All).c_str());
+       fl_addto_choice(file_->choice_height, choice_Length_All.c_str());
 
-       bc().addReadOnly(file_->button_browse);
-       bc().addReadOnly(file_->check_subcaption);
-       bc().addReadOnly(file_->check_rotate);
+       bc().addReadOnly(file_->button_browse);   
+       bc().addReadOnly(file_->check_aspectratio);
        bc().addReadOnly(file_->check_draft);
        bc().addReadOnly(file_->check_nounzip);
 
@@ -120,141 +116,31 @@ void FormGraphics::build()
        str = _("Browse the directories.");
        tooltips().init(file_->button_browse, str);
 
-       str = _("Enables use of subfigure with an own caption.");
-       tooltips().init(file_->check_subcaption, str);
-       str = _("Insert the an optional subfigure caption");
-       tooltips().init(file_->input_subcaption, str);
-
-       str = _("Enables use of rotating for the image.");
-       tooltips().init(file_->check_rotate, str);
-       str = _("Insert the rotating angle in degrees (max 5 characters like 270.1)");
-       tooltips().init(file_->input_rotate_angle, str);
-
-       str = _("Insert the rotating origin point.");
-       tooltips().init(file_->choice_origin, str);
+       str = _("Scale the image to inserted percentage value");
+       tooltips().init(file_->input_lyxscale, str);
+       str = _("Select display mode for this image.");
+       tooltips().init(file_->choice_display, str);
+
+       str = _("Set the image width to the inserted value.");
+       tooltips().init(file_->input_width, str);
+       str = _("Select unit for width; Scale% for scaling whole image");
+       tooltips().init(file_->choice_width, str);
+       str = _("Set the image height to the inserted value.");
+       tooltips().init(file_->input_height, str);
+       str = _("Select unit for height");
+       tooltips().init(file_->choice_height, str);
+       str = _("Do not distort the image. " 
+                "Keep image within \"width\" by \"height\" and obey aspect ratio.");
+       tooltips().init(file_->check_aspectratio, str);
 
        str = _("Pass a filename like \"file.eps.gz\" to the LaTeX output. "
            "This is useful when LaTeX should unzip the file. Needs an additional file "
-           "like \"file.eps.bb\" which holds the values for the bounding box");
+           "like \"file.eps.bb\" which holds the values for the bounding box.");
        tooltips().init(file_->check_nounzip, str);
 
        str = _("Show image only as a rectangle of the original size.");
        tooltips().init(file_->check_draft, str);
 
-       // the lyxview section
-       lyxview_.reset(build_graphics_lyxview(this));
-
-       fl_set_input_return (lyxview_->input_lyxwidth, FL_RETURN_CHANGED);
-       fl_set_input_return (lyxview_->input_lyxheight, FL_RETURN_CHANGED);
-       fl_set_input_return (lyxview_->input_lyxscale, FL_RETURN_CHANGED);
-
-       setPrehandler(lyxview_->input_lyxwidth);
-       setPrehandler(lyxview_->input_lyxheight);
-       setPrehandler(lyxview_->input_lyxscale);
-
-       fl_addto_choice(lyxview_->choice_lyxwidth, choice_Length_WithUnit.c_str());
-       fl_addto_choice(lyxview_->choice_lyxheight, choice_Length_WithUnit.c_str());
-
-       bc().addReadOnly(lyxview_->radio_pref);
-       bc().addReadOnly(lyxview_->radio_mono);
-       bc().addReadOnly(lyxview_->radio_gray);
-       bc().addReadOnly(lyxview_->radio_color);
-       bc().addReadOnly(lyxview_->radio_nodisplay);
-       bc().addReadOnly(lyxview_->check_lyxaspectratio);
-
-       // set up the tooltips for the lyxview section
-       str = _("Take the definition from the Preferences->Look&Feel->Misc as default.");
-       tooltips().init(lyxview_->radio_pref, str);
-       str = _("Show this image in black and white (monochrome).");
-       tooltips().init(lyxview_->radio_mono, str);
-       str = _("Show this image in grayscale.");
-       tooltips().init(lyxview_->radio_gray, str);
-       str = _("Show this image in color.");
-       tooltips().init(lyxview_->radio_color, str);
-       str = _("Do not display this image.");
-       tooltips().init(lyxview_->radio_nodisplay, str);
-
-       str = _("Copies all values from the LaTeX tab");
-       tooltips().init(lyxview_->button_latex_values, str);
-
-       str = _("Show this image in it's original size.");
-       tooltips().init(lyxview_->radio_lyxasis, str);
-       str = _("Scale the image down to the inserted values.");
-       tooltips().init(lyxview_->radio_lyxwh, str);
-       str = _("Scale the image down to the inserted value and keep aspectratio.");
-       tooltips().init(lyxview_->radio_lyxscale, str);
-
-       str = _("Insert a width in any valid unit to which the image in the LyX-view "
-               "should be scaled up/down");
-       tooltips().init(lyxview_->input_lyxwidth, str);
-       str = _("Insert a height in any valid unit to which the image in the LyX-view "
-               "should be scaled up/down");
-       tooltips().init(lyxview_->input_lyxheight, str);
-       str = _("Insert a value > 0 in persent to which the image should be scaled up/down");
-       tooltips().init(lyxview_->input_lyxscale, str);
-       str = _("Shows all possible units for the length");
-       tooltips().init(lyxview_->choice_lyxwidth, str);
-       tooltips().init(lyxview_->choice_lyxheight, str);
-       str = _("Modifies the meaning of the \"width\" and \"height\" (and "
-               "\"totalheight\") keys such that if both are specified then rather than "
-               "distort the figure the figure is scaled such that neither dimension "
-               "exceeds the stated dimensions.");
-       tooltips().init(lyxview_->check_lyxaspectratio, str);
-
-       // the size section
-       size_.reset(build_graphics_size(this));
-
-       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);
-
-       setPrehandler(size_->input_scale);
-       setPrehandler(size_->input_width);
-       setPrehandler(size_->input_height);
-
-       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_addto_choice(size_->choice_width, choice_Length_All.c_str());
-       fl_addto_choice(size_->choice_height, choice_Length_All.c_str());
-
-       bc().addReadOnly(size_->radio_asis);
-       bc().addReadOnly(size_->radio_wh);
-       bc().addReadOnly(size_->radio_scale);
-       bc().addReadOnly(size_->check_aspectratio);
-
-       // set up the tooltips for the size section
-       str = _("Copies all values from the LyX tab");
-       tooltips().init(size_->button_lyx_values, str);
-
-       str = _("Show this image in it's original size.");
-       tooltips().init(size_->radio_asis, str);
-       str = _("Scale the image down to the inserted values.");
-       tooltips().init(size_->radio_wh, str);
-       str = _("Scale the image down to the inserted value and keep aspectratio.");
-       tooltips().init(size_->radio_scale, str);
-
-       str = _("Modifies the meaning of the \"width\" and \"height\" (and "
-               "\"totalheight\") keys such that if both are specified then rather than "
-               "distort the figure the figure is scaled such that neither dimension "
-               "exceeds the stated dimensions.");
-       tooltips().init(size_->check_aspectratio, str);
-
-       str = _("Insert a width in any valid unit to which the image in the LyX-view "
-               "should be scaled up/down");
-       tooltips().init(lyxview_->input_lyxwidth, str);
-       str = _("Insert a height in any valid unit to which the image in the LyX-view "
-               "should be scaled up/down");
-       tooltips().init(lyxview_->input_lyxheight, str);
-       str = _("Insert a value > 0 in persent to which the image should be scaled up/down");
-       tooltips().init(lyxview_->input_lyxscale, str);
-       str = _("Shows all possible units for the length");
-       tooltips().init(lyxview_->choice_lyxwidth, str);
-       tooltips().init(lyxview_->choice_lyxheight, str);
-
        // the bounding box selection
        bbox_.reset(build_graphics_bbox(this));
        fl_set_input_return (bbox_->input_bb_x0, FL_RETURN_CHANGED);
@@ -262,10 +148,10 @@ void FormGraphics::build()
        fl_set_input_return (bbox_->input_bb_x1, FL_RETURN_CHANGED);
        fl_set_input_return (bbox_->input_bb_y1, FL_RETURN_CHANGED);
 
-       fl_set_input_filter(bbox_->input_bb_x0,  fl_unsigned_float_filter);
-       fl_set_input_filter(bbox_->input_bb_y0,  fl_unsigned_float_filter);
-       fl_set_input_filter(bbox_->input_bb_x1,  fl_unsigned_float_filter);
-       fl_set_input_filter(bbox_->input_bb_y1,  fl_unsigned_float_filter);
+       fl_set_input_filter(bbox_->input_bb_x0, fl_unsigned_float_filter);
+       fl_set_input_filter(bbox_->input_bb_y0, fl_unsigned_float_filter);
+       fl_set_input_filter(bbox_->input_bb_x1, fl_unsigned_float_filter);
+       fl_set_input_filter(bbox_->input_bb_y1, fl_unsigned_float_filter);
 
        setPrehandler(bbox_->input_bb_x0);
        setPrehandler(bbox_->input_bb_y0);
@@ -286,39 +172,72 @@ void FormGraphics::build()
        tooltips().init(bbox_->input_bb_x1, str);
        str = _("The upper right y-value of the bounding box");
        tooltips().init(bbox_->input_bb_y1, str);
-       str = _("Shows all possible units for the bounding box values");
+       str = _("Select unit for the bounding box values");
        tooltips().init(bbox_->choice_bb_units, str);
 
        str = _("Read the image coordinates new from file. If it's an (e)ps-file "
-               "than the bounding box is read otherwise the imagesize in pixels. "
-               "The default unit is \"bp\" the PostScript b)ig p)oint.");
+               "then the bounding box is read otherwise the imagesize in pixels. "
+               "The default unit is \"bp\", the PostScript's b(ig) p(oint).");
        tooltips().init(bbox_->button_getBB, str);
 
        str = _("Enable this checkbox when the image should be clipped to the "
                "bounding box values.");
        tooltips().init(bbox_->check_clip, str);
 
-       // the rotate section
-       special_.reset(build_graphics_special(this));
+       // the extra section
+       extra_.reset(build_graphics_extra(this));
+
+       fl_set_input_return (extra_->input_rotate_angle, FL_RETURN_CHANGED);
+       fl_set_input_return (extra_->input_subcaption, FL_RETURN_CHANGED);
+       fl_set_input_return (extra_->input_special, FL_RETURN_CHANGED);
 
-       fl_set_input_return (special_->input_special, FL_RETURN_CHANGED);
-       setPrehandler(special_->input_special);
+       fl_set_input_filter(extra_->input_rotate_angle, fl_float_filter);
 
-       // set up the tooltips for the special section
-       str = _("Any additional option, which is defined in the graphicx-package "
-               "and not mentioned in the gui's tabfolders can be defined.");
-       tooltips().init(special_->input_special, str);
+       setPrehandler(extra_->input_rotate_angle);
+       setPrehandler(extra_->input_subcaption);
+       setPrehandler(extra_->input_special);
+
+       bc().addReadOnly(extra_->check_subcaption);
+
+       using namespace frnt;
+       vector<RotationOriginPair> origindata = getRotationOriginData();
+
+       // Store the identifiers for later
+       origins_ = getSecond(origindata);
+
+       string const choice = " " + getStringFromVector(getFirst(origindata), " | ") + " ";
+       fl_addto_choice(extra_->choice_origin, choice.c_str());
+
+       // set up the tooltips for the extra section
+       str = _("Insert the rotation angle in degrees. "
+               "Positive value rotates anti-clockwise, negative value clockwise");
+       tooltips().init(extra_->input_rotate_angle, str);
+       str = _("Insert the point of origin for rotation ");
+       tooltips().init(extra_->choice_origin, str);
+       str = _("Enables use of subfigure with its own caption.");
+       tooltips().init(extra_->check_subcaption, str);
+       str = _("Insert the optional subfigure caption");
+       tooltips().init(extra_->input_subcaption, str);
+       str = _("Add any additional latex option, which is defined in the "
+                "graphicx-package and not mentioned in the gui's tabfolders.");
+       tooltips().init(extra_->input_special, str);
 
        // add the different tabfolders
        fl_addto_tabfolder(dialog_->tabfolder, _("File"), file_->form);
-       fl_addto_tabfolder(dialog_->tabfolder, _("LyX View"), lyxview_->form);
-       fl_addto_tabfolder(dialog_->tabfolder, _("LaTeX Size"), size_->form);
        fl_addto_tabfolder(dialog_->tabfolder, _("Bounding Box"), bbox_->form);
-       fl_addto_tabfolder(dialog_->tabfolder, _("Extras"), special_->form);
+       fl_addto_tabfolder(dialog_->tabfolder, _("Extra"), extra_->form);
 
        // set the right default unit
-       if (lyxrc.default_papersize < 3)
-               defaultUnit = "in";
+       switch (lyxrc.default_papersize) {
+       case BufferParams::PAPER_DEFAULT: break;
+       case BufferParams::PAPER_USLETTER:
+       case BufferParams::PAPER_LEGALPAPER:
+       case BufferParams::PAPER_EXECUTIVEPAPER: defaultUnit = "in"; break;
+       case BufferParams::PAPER_A3PAPER:
+       case BufferParams::PAPER_A4PAPER:
+       case BufferParams::PAPER_A5PAPER:
+       case BufferParams::PAPER_B5PAPER: defaultUnit = "cm"; break;
+       }
 }
 
 
@@ -329,75 +248,40 @@ void FormGraphics::apply()
 
        // the file section
        igp.filename = getString(file_->input_filename);
-       igp.subcaption = fl_get_button(file_->check_subcaption);
-       igp.subcaptionText = getString(file_->input_subcaption);
-       igp.rotate = fl_get_button(file_->check_rotate);
-       igp.rotateAngle =
-               strToDbl(getString(file_->input_rotate_angle));
-       while (igp.rotateAngle < 0.0 || igp.rotateAngle > 360.0) {
-               if (igp.rotateAngle < 0.0) {
-                       igp.rotateAngle += 360.0;
-               } else if (igp.rotateAngle > 360.0) {
-                       igp.rotateAngle -= 360.0;
-               }
+
+       igp.lyxscale = strToInt(getString(file_->input_lyxscale));
+       if (igp.lyxscale == 0) igp.lyxscale = 100;
+       
+       switch (fl_get_choice(file_->choice_display)) {
+               case 5: igp.display = grfx::NoDisplay; break;
+               case 4: igp.display = grfx::ColorDisplay; break;
+               case 3: igp.display = grfx::GrayscaleDisplay; break;
+               case 2: igp.display = grfx::MonochromeDisplay; break;
+               case 1:
+               default: igp.display = grfx::DefaultDisplay;
        }
-       int const pos = fl_get_choice(file_->choice_origin);
-       if (pos > 0)
-               igp.rotateOrigin = origins_[pos-1];
-       else
-               igp.rotateOrigin = string();
+
+       // first item in choice_width means scaling
+       if (fl_get_choice(file_->choice_width) == 1) {
+               igp.scale = strToInt(getString(file_->input_width));
+               if (igp.scale == 0) igp.scale = 100;
+               igp.width = LyXLength();
+       }
+       else {
+               igp.scale = 0;
+               igp.width = getLyXLengthFromWidgets(file_->input_width,
+                                                   file_->choice_width);
+       }
+       igp.height = getLyXLengthFromWidgets(file_->input_height,
+                                            file_->choice_height);
+       igp.keepAspectRatio = fl_get_button(file_->check_aspectratio);
 
        igp.draft = fl_get_button(file_->check_draft);
        igp.noUnzip = fl_get_button(file_->check_nounzip);
 
-       // the lyxview section
-       if (fl_get_button(lyxview_->radio_pref))
-               igp.display = InsetGraphicsParams::DEFAULT;
-       else if (fl_get_button(lyxview_->radio_mono))
-               igp.display = InsetGraphicsParams::MONOCHROME;
-       else if (fl_get_button(lyxview_->radio_gray))
-               igp.display = InsetGraphicsParams::GRAYSCALE;
-       else if (fl_get_button(lyxview_->radio_color))
-               igp.display = InsetGraphicsParams::COLOR;
-       else if (fl_get_button(lyxview_->radio_nodisplay))
-               igp.display = InsetGraphicsParams::NONE;
-
-       if (fl_get_button(lyxview_->radio_lyxasis))
-               igp.lyxsize_kind = InsetGraphicsParams::DEFAULT_SIZE;
-       else if (fl_get_button(lyxview_->radio_lyxwh))
-               igp.lyxsize_kind = InsetGraphicsParams::WH;
-       else
-               igp.lyxsize_kind = InsetGraphicsParams::SCALE;
-
-       igp.lyxwidth = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
-                                              lyxview_->choice_lyxwidth);
-
-       igp.lyxheight = getLyXLengthFromWidgets(lyxview_->input_lyxheight,
-                                               lyxview_->choice_lyxheight);
-
-       igp.lyxscale = strToInt(getString(lyxview_->input_lyxscale));
-       igp.keepLyXAspectRatio = fl_get_button(lyxview_->check_lyxaspectratio);
-
-       // the size section
-       if (fl_get_button(size_->radio_asis))
-               igp.size_kind = InsetGraphicsParams::DEFAULT_SIZE;
-       else if (fl_get_button(size_->radio_wh))
-               igp.size_kind = InsetGraphicsParams::WH;
-       else
-               igp.size_kind = InsetGraphicsParams::SCALE;
-
-       igp.width = getLyXLengthFromWidgets(size_->input_width,
-                                           size_->choice_width);
-
-       igp.height = getLyXLengthFromWidgets(size_->input_height,
-                                  size_->choice_height);
-
-       igp.scale = strToInt(getString(size_->input_scale));
-       igp.keepAspectRatio = fl_get_button(size_->check_aspectratio);
-
        // the bb section
-       if (!controller().bbChanged)            // different to the original one?
-               igp.bb = string();                      // don't write anything
+       if (!controller().bbChanged)    // different to the original one?
+               igp.bb = string();      // don't write anything
        else {
                string bb;
                if (getString(bbox_->input_bb_x0).empty())
@@ -424,8 +308,21 @@ void FormGraphics::apply()
        }
        igp.clip = fl_get_button(bbox_->check_clip);
 
-       // the special section
-       igp.special = getString(special_->input_special);
+       // the extra section
+       igp.rotateAngle = strToDbl(getString(extra_->input_rotate_angle));
+       
+       // map angle into -360 (clock-wise) to +360 (counter clock-wise)
+       while (igp.rotateAngle <= -360.0) igp.rotateAngle += 360.0;
+       while (igp.rotateAngle >=  360.0) igp.rotateAngle -= 360.0;
+       fl_set_input(extra_->input_rotate_angle, tostr(igp.rotateAngle).c_str());
+
+       int const origin_pos = fl_get_choice(extra_->choice_origin);
+       igp.rotateOrigin = origins_[origin_pos-1];
+
+       igp.subcaption = fl_get_button(extra_->check_subcaption);
+       igp.subcaptionText = getString(extra_->input_subcaption);
+
+       igp.special = getString(extra_->input_special);
 }
 
 
@@ -435,127 +332,45 @@ void FormGraphics::update() {
 
        // the file section
        fl_set_input(file_->input_filename, igp.filename.c_str());
-       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));
-       fl_set_button(file_->check_rotate, igp.rotate);
-       fl_set_input(file_->input_rotate_angle,
-                    tostr(igp.rotateAngle).c_str());
-       if (igp.rotateOrigin.empty())
-               fl_set_choice(file_->choice_origin,1);
+       fl_set_input(file_->input_lyxscale, tostr(igp.lyxscale).c_str());
+
+       switch (igp.display) {
+               case grfx::NoDisplay:           fl_set_choice(file_->choice_display, 5); break;
+               case grfx::ColorDisplay:        fl_set_choice(file_->choice_display, 4); break;
+               case grfx::GrayscaleDisplay:    fl_set_choice(file_->choice_display, 3); break;
+               case grfx::MonochromeDisplay:   fl_set_choice(file_->choice_display, 2); break;
+               case grfx::DefaultDisplay:
+               default:                        fl_set_choice(file_->choice_display, 1);
+       }
+
+       // disable height input in case of scaling
+       setEnabled(file_->input_height, !igp.scale);
+       setEnabled(file_->choice_height, !igp.scale);
+
+       // set width input fields according to scaling or width/height input
+       if (igp.scale) {
+               fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
+               fl_set_input(file_->input_width, tostr(igp.scale).c_str());
+               fl_set_choice(file_->choice_width, 1);
+       }
        else {
-               int pos = int(findPos(origins_, igp.rotateOrigin));
-               fl_set_choice(file_->choice_origin, pos+1);
+               fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
+               updateWidgetsFromLength(file_->input_width,
+                                       file_->choice_width, igp.width, defaultUnit);
        }
 
-       setEnabled(file_->input_rotate_angle,
-                  fl_get_button(file_->check_rotate));
-       setEnabled(file_->choice_origin,
-                  fl_get_button(file_->check_rotate));
+       updateWidgetsFromLength(file_->input_height,
+                               file_->choice_height, igp.height, defaultUnit);
+       
+       fl_set_button(file_->check_aspectratio, igp.keepAspectRatio);
        fl_set_button(file_->check_draft, igp.draft);
        fl_set_button(file_->check_nounzip, igp.noUnzip);
 
-       // the lyxview section
-       switch (igp.display) {
-       case InsetGraphicsParams::DEFAULT:
-               fl_set_button(lyxview_->radio_pref, 1);
-               break;
-       case InsetGraphicsParams::MONOCHROME:
-               fl_set_button(lyxview_->radio_mono, 1);
-               break;
-       case InsetGraphicsParams::GRAYSCALE:
-               fl_set_button(lyxview_->radio_gray, 1);
-               break;
-       case InsetGraphicsParams::COLOR:
-               fl_set_button(lyxview_->radio_color, 1);
-               break;
-       case InsetGraphicsParams::NONE:
-               fl_set_button(lyxview_->radio_nodisplay, 1);
-               break;
-       }
-       updateWidgetsFromLength(lyxview_->input_lyxwidth,
-                               lyxview_->choice_lyxwidth, igp.lyxwidth, defaultUnit);
-       updateWidgetsFromLength(lyxview_->input_lyxheight,
-                               lyxview_->choice_lyxheight, igp.lyxheight, defaultUnit);
-       fl_set_input(lyxview_->input_lyxscale, tostr(igp.lyxscale).c_str());
-       switch (igp.lyxsize_kind) {
-       case InsetGraphicsParams::DEFAULT_SIZE: {
-               fl_set_button(lyxview_->radio_lyxasis,1);
-               setEnabled(lyxview_->input_lyxwidth, 0);
-               setEnabled(lyxview_->choice_lyxwidth, 0);
-               setEnabled(lyxview_->input_lyxheight, 0);
-               setEnabled(lyxview_->choice_lyxheight, 0);
-               setEnabled(lyxview_->check_lyxaspectratio, 0);
-               setEnabled(lyxview_->input_lyxscale, 0);
-               break;
-       }
-       case InsetGraphicsParams::SCALE: {
-               fl_set_button(lyxview_->radio_lyxscale, 1);
-               setEnabled(lyxview_->input_lyxwidth, 0);
-               setEnabled(lyxview_->choice_lyxwidth, 0);
-               setEnabled(lyxview_->input_lyxheight, 0);
-               setEnabled(lyxview_->choice_lyxheight, 0);
-               setEnabled(lyxview_->input_lyxscale, 1);
-               break;
-       }
-       case InsetGraphicsParams::WH: {
-               fl_set_button(lyxview_->radio_lyxwh, 1);
-               setEnabled(lyxview_->input_lyxwidth, 1);
-               setEnabled(lyxview_->choice_lyxwidth, 1);
-               setEnabled(lyxview_->input_lyxheight, 1);
-               setEnabled(lyxview_->choice_lyxheight, 1);
-               setEnabled(lyxview_->check_lyxaspectratio, 1);
-               setEnabled(lyxview_->input_lyxscale, 0);
-               break;
-       }
-       }
-       fl_set_button(lyxview_->check_lyxaspectratio, igp.keepLyXAspectRatio);
-
-       fl_set_button(lyxview_->check_lyxaspectratio, igp.keepLyXAspectRatio);
-
-       // the size section
-       // Update the draft and clip mode
-       updateWidgetsFromLength(size_->input_width,
-                               size_->choice_width, igp.width, defaultUnit);
-       updateWidgetsFromLength(size_->input_height,
-                               size_->choice_height, igp.height, defaultUnit);
-       fl_set_input(size_->input_scale, tostr(igp.scale).c_str());
-       lyxerr[Debug::GRAPHICS] << "FormGraphics::update: igp.size_kind = "
-                               <<  igp.size_kind << endl;
-       switch (igp.size_kind) {
-       case InsetGraphicsParams::DEFAULT_SIZE: {
-               fl_set_button(size_->radio_asis,1);
-               setEnabled(size_->input_width, 0);
-               setEnabled(size_->choice_width, 0);
-               setEnabled(size_->input_height, 0);
-               setEnabled(size_->choice_height, 0);
-               setEnabled(size_->check_aspectratio, 0);
-               setEnabled(size_->input_scale, 0);
-               break;
-       }
-       case InsetGraphicsParams::SCALE: {
-               fl_set_button(size_->radio_scale, 1);
-               setEnabled(size_->input_width, 0);
-               setEnabled(size_->choice_width, 0);
-               setEnabled(size_->input_height, 0);
-               setEnabled(size_->choice_height, 0);
-               setEnabled(size_->check_aspectratio, 0);
-               setEnabled(size_->input_scale, 1);
-               break;
-       }
-       case InsetGraphicsParams::WH: {
-               fl_set_button(size_->radio_wh, 1);
-               setEnabled(size_->input_width, 1);
-               setEnabled(size_->choice_width, 1);
-               setEnabled(size_->input_height, 1);
-               setEnabled(size_->choice_height, 1);
-               setEnabled(size_->check_aspectratio, 1);
-               setEnabled(size_->input_scale, 0);
-               break;
-       }
-       }
-       fl_set_button(size_->check_aspectratio, igp.keepAspectRatio);
+       // disable aspectratio button in case of scaling or one of width/height is empty
+       bool const disable_aspectRatio = igp.scale ||
+                               getString(file_->input_width).empty() ||
+                               getString(file_->input_height).empty();
+       setEnabled(file_->check_aspectratio, !disable_aspectRatio);
 
        // the bb section
        // set the bounding box values, if exists. First we need the whole
@@ -563,8 +378,23 @@ void FormGraphics::update() {
        updateBB(igp.filename, igp.bb);
        fl_set_button(bbox_->check_clip, igp.clip);
 
-       // the special section
-       fl_set_input(special_->input_special, igp.special.c_str());
+
+       // the extra section
+       fl_set_input(extra_->input_rotate_angle,
+                    tostr(igp.rotateAngle).c_str());
+       if (igp.rotateOrigin.empty())
+               fl_set_choice(extra_->choice_origin, 1);
+       else
+               fl_set_choice(extra_->choice_origin,
+                             1 + int(findPos(origins_, igp.rotateOrigin)) );
+       fl_set_button(extra_->check_subcaption, igp.subcaption);
+       fl_set_input(extra_->input_subcaption, igp.subcaptionText.c_str());
+       setEnabled(extra_->input_subcaption,
+                  fl_get_button(extra_->check_subcaption));
+       fl_set_input(extra_->input_special, igp.special.c_str());
+
+       // open dialog in the file-tab, whenever filename is empty
+       if (igp.filename.empty()) fl_set_folder(dialog_->tabfolder, file_->form);
 }
 
 
@@ -646,90 +476,29 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
                if (controller().isFilenameValid(out_name) &&
                    !controller().bbChanged)
                        updateBB(out_name, string());
+       } else if (ob == file_->input_width || ob == file_->input_height) {
+               // disable aspectratio button in case of scaling or one of width/height is empty
+               bool const disable = fl_get_choice(file_->choice_width) == 1 ||
+                                   getString(file_->input_width).empty() ||
+                                   getString(file_->input_height).empty();
+               setEnabled(file_->check_aspectratio, !disable);
+       } else if (ob == file_->choice_width) {
+               // disable height input in case of scaling
+               bool const scaling = fl_get_choice(file_->choice_width) == 1;
+               setEnabled(file_->input_height, !scaling);
+               setEnabled(file_->choice_height, !scaling);
+               
+               // allow only integer intput for scaling; float otherwise
+               if (scaling)
+                       fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
+               else
+                       fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
 
-       } else if (ob == file_->check_subcaption) {
-               setEnabled(file_->input_subcaption,
-                          fl_get_button(file_->check_subcaption));
-       } else if (ob == file_->check_rotate) {
-               setEnabled(file_->input_rotate_angle,
-                          fl_get_button(file_->check_rotate));
-               setEnabled(file_->choice_origin,
-                          fl_get_button(file_->check_rotate));
-
-               // the lyxview section
-       } else if (ob == lyxview_->radio_lyxasis) {
-               setEnabled(lyxview_->input_lyxwidth, 0);
-               setEnabled(lyxview_->choice_lyxwidth, 0);
-               setEnabled(lyxview_->input_lyxheight, 0);
-               setEnabled(lyxview_->choice_lyxheight, 0);
-               setEnabled(lyxview_->check_lyxaspectratio, 0);
-               setEnabled(lyxview_->input_lyxscale, 0);
-       } else if (ob == lyxview_->radio_lyxscale) {
-               setEnabled(lyxview_->input_lyxwidth, 0);
-               setEnabled(lyxview_->choice_lyxwidth, 0);
-               setEnabled(lyxview_->input_lyxheight, 0);
-               setEnabled(lyxview_->choice_lyxheight, 0);
-               setEnabled(lyxview_->check_lyxaspectratio, 0);
-               setEnabled(lyxview_->input_lyxscale, 1);
-       } else if (ob == lyxview_->radio_lyxwh) {
-               setEnabled(lyxview_->input_lyxwidth, 1);
-               setEnabled(lyxview_->choice_lyxwidth, 1);
-               setEnabled(lyxview_->input_lyxheight, 1);
-               setEnabled(lyxview_->choice_lyxheight, 1);
-               setEnabled(lyxview_->check_lyxaspectratio, 1);
-               setEnabled(lyxview_->input_lyxscale, 0);
-       } else if (ob == lyxview_->button_latex_values) {
-               if (contains(fl_get_choice_text(size_->choice_width), '%') ||
-                   contains(fl_get_choice_text(size_->choice_height), '%'))
-                       Alert::alert(_("Warning!"),
-                                    _("The %-units are not allowed here."),
-                                    _("Cannot use the values from LaTeX size!"));
-               else {
-                       LyXLength dummy =
-                               getLyXLengthFromWidgets(size_->input_width,
-                                                       size_->choice_width);
-                       updateWidgetsFromLength(lyxview_->input_lyxwidth,
-                                               lyxview_->choice_lyxwidth,
-                                               dummy, defaultUnit);
-
-                       dummy = getLyXLengthFromWidgets(size_->input_height,
-                                                       size_->choice_height);
-                       updateWidgetsFromLength(lyxview_->input_lyxheight,
-                                               lyxview_->choice_lyxheight,
-                                               dummy, defaultUnit);
-                       string const scale = getString(size_->input_scale);
-                       fl_set_input(lyxview_->input_lyxscale, scale.c_str());
-                       if (fl_get_button (size_->radio_asis) == 1) {
-                               fl_set_button (lyxview_->radio_lyxasis, 1);
-                               setEnabled(lyxview_->input_lyxwidth, 0);
-                               setEnabled(lyxview_->choice_lyxwidth, 0);
-                               setEnabled(lyxview_->input_lyxheight, 0);
-                               setEnabled(lyxview_->choice_lyxheight, 0);
-                               setEnabled(lyxview_->check_lyxaspectratio, 0);
-                               setEnabled(lyxview_->input_lyxscale, 0);
-                       } else if (fl_get_button (size_->radio_scale) ==1) {
-                               fl_set_button (lyxview_->radio_lyxscale, 1);
-                               setEnabled(lyxview_->input_lyxwidth, 0);
-                               setEnabled(lyxview_->choice_lyxwidth, 0);
-                               setEnabled(lyxview_->input_lyxheight, 0);
-                               setEnabled(lyxview_->choice_lyxheight, 0);
-                               setEnabled(lyxview_->check_lyxaspectratio, 0);
-                               setEnabled(lyxview_->input_lyxscale, 1);
-                       } else if (fl_get_button (size_->radio_wh) == 1) {
-                               fl_set_button (lyxview_->radio_lyxwh, 1);
-                               setEnabled(lyxview_->input_lyxwidth, 1);
-                               setEnabled(lyxview_->choice_lyxwidth, 1);
-                               setEnabled(lyxview_->input_lyxheight, 1);
-                               setEnabled(lyxview_->choice_lyxheight, 1);
-                               setEnabled(lyxview_->check_lyxaspectratio, 1);
-                               setEnabled(lyxview_->input_lyxscale, 0);
-                               setEnabled(lyxview_->check_lyxaspectratio, 1);
-                       }
-               }
-               fl_set_button(lyxview_->check_lyxaspectratio,
-                       fl_get_button(size_->check_aspectratio));
 
-               // the bb section
+               // disable aspectratio button in case of scaling or height input is empty
+               bool const disable_aspectratio = scaling || getString(file_->input_height).empty();
+               setEnabled(file_->check_aspectratio, !disable_aspectratio);
+       // the bb section
        } else if (!controller().bbChanged &&
                   (ob == bbox_->check_clip  || ob == bbox_->choice_bb_units ||
                    ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_y0 ||
@@ -744,8 +513,7 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
                                fl_set_input(bbox_->input_bb_y0, token(bb,' ',1).c_str());
                                fl_set_input(bbox_->input_bb_x1, token(bb,' ',2).c_str());
                                fl_set_input(bbox_->input_bb_y1, token(bb,' ',3).c_str());
-                               string const unit("bp");
-                               fl_set_choice_text(bbox_->choice_bb_units, unit.c_str());
+                               fl_set_choice_text(bbox_->choice_bb_units, "bp");
                        }
                        controller().bbChanged = false;
                } else {
@@ -755,92 +523,23 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
                        fl_set_input(bbox_->input_bb_y1, "");
                        fl_set_choice_text(bbox_->choice_bb_units, "bp");
                }
+       // the extra section
+       } else if (ob == extra_->check_subcaption) {
+               setEnabled(extra_->input_subcaption,
+                          fl_get_button(extra_->check_subcaption));
 
-               // the size section
-       } else if (ob == size_->radio_asis) {
-               setEnabled(size_->input_width, 0);
-               setEnabled(size_->choice_width, 0);
-               setEnabled(size_->input_height, 0);
-               setEnabled(size_->choice_height, 0);
-               setEnabled(size_->check_aspectratio, 0);
-               setEnabled(size_->input_scale, 0);
-       } else if (ob == size_->radio_scale) {
-               setEnabled(size_->input_width, 0);
-               setEnabled(size_->choice_width, 0);
-               setEnabled(size_->input_height, 0);
-               setEnabled(size_->choice_height, 0);
-               setEnabled(size_->check_aspectratio, 0);
-               setEnabled(size_->input_scale, 1);
-       } else if (ob == size_->radio_wh) {
-               setEnabled(size_->input_width, 1);
-               setEnabled(size_->choice_width, 1);
-               setEnabled(size_->input_height, 1);
-               setEnabled(size_->choice_height, 1);
-               setEnabled(size_->check_aspectratio, 1);
-               setEnabled(size_->input_scale, 0);
-       } else if (ob == size_->button_lyx_values) {
-               LyXLength dummy = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
-                                                         lyxview_->choice_lyxwidth);
-               updateWidgetsFromLength(size_->input_width,
-                                       size_->choice_width,
-                                       dummy, defaultUnit);
-               dummy = getLyXLengthFromWidgets(lyxview_->input_lyxheight,
-                                               lyxview_->choice_lyxheight);
-               updateWidgetsFromLength(size_->input_height,
-                                       size_->choice_height,
-                                       dummy, defaultUnit);
-               string const scale = getString(lyxview_->input_lyxscale);
-               fl_set_input(size_->input_scale, scale.c_str());
-               if (fl_get_button (lyxview_->radio_lyxasis) == 1) {
-                       fl_set_button (size_->radio_asis, 1);
-                       setEnabled(size_->input_width, 0);
-                       setEnabled(size_->choice_width, 0);
-                       setEnabled(size_->input_height, 0);
-                       setEnabled(size_->choice_height, 0);
-                       setEnabled(size_->check_aspectratio, 0);
-                       setEnabled(size_->input_scale, 0);
-               } else if (fl_get_button (lyxview_->radio_lyxscale) ==1) {
-                       fl_set_button (size_->radio_scale, 1);
-                       setEnabled(size_->input_width, 0);
-                       setEnabled(size_->choice_width, 0);
-                       setEnabled(size_->input_height, 0);
-                       setEnabled(size_->choice_height, 0);
-                       setEnabled(size_->check_aspectratio, 0);
-                       setEnabled(size_->input_scale, 1);
-               } else if (fl_get_button (lyxview_->radio_lyxwh) == 1) {
-                       fl_set_button (size_->radio_wh, 1);
-                       setEnabled(size_->input_width, 1);
-                       setEnabled(size_->choice_width, 1);
-                       setEnabled(size_->input_height, 1);
-                       setEnabled(size_->choice_height, 1);
-                       setEnabled(size_->check_aspectratio, 1);
-                       setEnabled(size_->input_scale, 0);
-               }
-               fl_set_button(size_->check_aspectratio,
-                             fl_get_button(lyxview_->check_lyxaspectratio));
        }
 
-       // check if the input is valid
-       bool invalid = !isValid(bbox_->input_bb_x0);
-       invalid = invalid || !isValid(bbox_->input_bb_x1);
-       invalid = invalid || !isValid(bbox_->input_bb_y0);
-       invalid = invalid || !isValid(bbox_->input_bb_y1);
-       invalid = invalid || !isValid(size_->input_width);
-       invalid = invalid || !isValid(size_->input_height);
-       invalid = invalid || !isValid(lyxview_->input_lyxwidth);
-       invalid = invalid || !isValid(lyxview_->input_lyxheight);
-
        // deactivate OK/ Apply buttons and
        // spit out warnings if invalid
        if (ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_x1 ||
            ob == bbox_->input_bb_y0 || ob == bbox_->input_bb_y1 ||
-           ob == size_->input_width || ob == size_->input_height ||
-           ob == lyxview_->input_lyxwidth || ob == lyxview_->input_lyxheight) {
-               if (invalid) {
+           ob == file_->input_width || ob == file_->input_height) {
+               if (isValid(ob))
+                       clearMessage();
+               else {
                        postWarning(_("Invalid Length!"));
                        return ButtonPolicy::SMI_INVALID;
-               } else {
-                       clearMessage();
                }
        }
 
index 2c4456707f47ca1a76d4c2600ccb8d6ac69e9da5..da837fb05e8e9388aa9d7a30055734c68bd868d1 100644 (file)
 class ControlGraphics;
 struct FD_graphics;
 struct FD_graphics_file;
-struct FD_graphics_lyxview;
-struct FD_graphics_size;
 struct FD_graphics_bbox;
-struct FD_graphics_special;
+struct FD_graphics_extra;
 
 /** This class provides an XForms implementation of the Graphics Dialog.
  */
@@ -55,13 +53,9 @@ private:
        /// Real GUI implementation.
        boost::scoped_ptr<FD_graphics_file> file_;
        ///
-       boost::scoped_ptr<FD_graphics_lyxview> lyxview_;
-       ///
-       boost::scoped_ptr<FD_graphics_size> size_;
-       ///
        boost::scoped_ptr<FD_graphics_bbox> bbox_;
        ///
-       boost::scoped_ptr<FD_graphics_special> special_;
+       boost::scoped_ptr<FD_graphics_extra> extra_;
 
        /// Store the LaTeX names for the rotation origins.
        std::vector<string> origins_;
index ad3ebdfc2a0d5432775f2f2c128100612ec5f669..0a317e270eb297a8a52188d46a979416633460da 100644 (file)
@@ -1826,13 +1826,13 @@ void FormPreferences::LnFmisc::apply() const
 
        string const old_value = lyxrc.display_graphics;
        if (fl_get_button(dialog_->radio_display_monochrome)) {
-               lyxrc.display_graphics = "mono";
+               lyxrc.display_graphics = "monochrome";
        } else if (fl_get_button(dialog_->radio_display_grayscale)) {
-               lyxrc.display_graphics = "gray";
+               lyxrc.display_graphics = "grayscale";
        } else if (fl_get_button(dialog_->radio_display_color)) {
                lyxrc.display_graphics = "color";
        } else {
-               lyxrc.display_graphics = "no";
+               lyxrc.display_graphics = "none";
        }
 
 #ifdef WITH_WARNINGS
@@ -1908,9 +1908,9 @@ void FormPreferences::LnFmisc::update()
        fl_set_counter_value(dialog_->counter_autosave, lyxrc.autosave);
        fl_set_counter_value(dialog_->counter_wm_jump, lyxrc.wheel_jump);
 
-       if (lyxrc.display_graphics == "mono") {
+       if (lyxrc.display_graphics == "monochrome") {
                fl_set_button(dialog_->radio_display_monochrome, 1);
-       } else if (lyxrc.display_graphics == "gray") {
+       } else if (lyxrc.display_graphics == "grayscale") {
                fl_set_button(dialog_->radio_display_grayscale, 1);
        } else if (lyxrc.display_graphics == "color") {
                fl_set_button(dialog_->radio_display_color, 1);
index 73e58f028233e44853335e6bdf4ce5be110a6cc4..c3e41270b27fba73e00472e87bb87ad8eb263e39 100644 (file)
@@ -3,7 +3,7 @@ Magic: 13000
 Internal Form Definition File
     (do not change)
 
-Number of forms: 6
+Number of forms: 4
 Unit of measure: FL_COORD_PIXEL
 SnapGrid: 5
 
@@ -124,7 +124,7 @@ argument: 0
 --------------------
 class: FL_TEXT
 type: NORMAL_TEXT
-box: 5 280 495 25
+box: 5 280 500 25
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
@@ -133,7 +133,7 @@ size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
 name: text_warning
 callback: C_FormBaseInputCB
@@ -143,7 +143,7 @@ argument: 0
 Name: form_graphics_file
 Width: 500
 Height: 245
-Number of Objects: 13
+Number of Objects: 15
 
 --------------------
 class: FL_BOX
@@ -163,6 +163,24 @@ name:
 callback: 
 argument: 
 
+--------------------
+class: FL_LABELFRAME
+type: ENGRAVED_FRAME
+box: 10 130 480 105
+boxtype: FL_NO_BOX
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Output
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
@@ -193,7 +211,7 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Browse...|#B
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
 name: button_browse
 callback: C_FormBaseInputCB
@@ -202,16 +220,16 @@ argument: 0
 --------------------
 class: FL_LABELFRAME
 type: ENGRAVED_FRAME
-box: 10 55 480 60
+box: 10 60 480 60
 boxtype: FL_NO_BOX
 colors: FL_BLACK FL_COL1
 alignment: FL_ALIGN_TOP_LEFT
-style: FL_BOLD_STYLE
+style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: 
+label: LyX View
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
 name: 
 callback: 
@@ -220,170 +238,188 @@ argument:
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 15 70 30 30
+box: 315 145 30 30
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_RIGHT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Subfigure|#S
+label: Draft mode|#m
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: check_subcaption
+name: check_draft
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 190 70 290 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 315 180 30 30
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_RIGHT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Title|#T
+label: Don't unzip, when\nexporting to LaTeX|#u
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: input_subcaption
+name: check_nounzip
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 10 115 480 60
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_BOLD_STYLE
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 95 75 70 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: 
+label: Scale|#S
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
+name: input_lyxscale
+callback: C_FormBaseInputCB
+argument: 0
 
 --------------------
 class: FL_INPUT
-type: INT_INPUT
-box: 190 130 55 30
+type: NORMAL_INPUT
+box: 95 145 70 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: Angle|#A
+label: Width|#W
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: input_rotate_angle
+name: input_width
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 245 130 38 30
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 165 145 50 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: deg
+label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
+name: choice_width
+callback: C_FormBaseInputCB
+argument: 0
 
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 360 130 118 28
+box: 165 175 50 30
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Origin|#O
+label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: choice_origin
+name: choice_height
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 15 195 30 30
+box: 95 205 30 30
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_RIGHT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Draft mode|#D
+label: keep Aspect ratio|#A
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: check_draft
+name: check_aspectratio
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 15 130 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 95 175 70 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: Rotate|#R
+label: Height|#H
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: check_rotate
+name: input_height
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 175 195 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
+class: FL_TEXT
+type: NORMAL_TEXT
+box: 165 75 30 30
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
+style: FL_NORMAL_STYLE
+size: FL_MEDIUM_SIZE
+lcol: FL_BLACK
+label: %
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 315 75 115 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Don't unzip, when exporting to LaTeX|#u
+label: Display|#D
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: check_nounzip
+name: choice_display
 callback: C_FormBaseInputCB
 argument: 0
 
 =============== FORM ===============
-Name: form_graphics_size
+Name: form_graphics_bbox
 Width: 500
 Height: 245
-Number of Objects: 16
+Number of Objects: 10
 
 --------------------
 class: FL_BOX
@@ -404,280 +440,172 @@ callback:
 argument: 
 
 --------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 355 10 135 50
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 10 10 480 225
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 135 55 50 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Output size
+label: Right top|#R
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
+name: input_bb_x1
+callback: C_FormBaseInputCB
+argument: 0
 
 --------------------
-class: FL_BEGIN_GROUP
-type: 0
-box: 0 10 10 0
-boxtype: FL_NO_BOX
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 190 55 50 30
+boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER
+alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 25 30 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Original size|#O
-shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: radio_asis
+name: input_bb_y1
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 25 80 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 135 90 50 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Scale|#S
+label: Left bottom|#L
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: radio_scale
+name: input_bb_x0
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 25 130 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 190 90 50 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_RIGHT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Custom|#C
+label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: radio_wh
+name: input_bb_y0
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
-class: FL_END_GROUP
-type: 0
-box: 0 0 0 0
-boxtype: FL_NO_BOX
+class: FL_TEXT
+type: NORMAL_TEXT
+box: 145 30 30 25
+boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER
+alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: 
+label: X
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
 name: 
 callback: 
 argument: 
 
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 200 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: Value|#V
-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: 285 80 25 30
+box: 200 30 30 25
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
+alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: %
+label: Y
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
 name: 
 callback: 
 argument: 
 
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 200 130 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: 290 130 60 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: choice_width
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 200 165 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: 290 165 60 30
+box: 260 70 45 30
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
+alignment: FL_ALIGN_RIGHT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: 
+label: Units|#U
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: choice_height
+name: choice_bb_units
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 200 200 30 30
+box: 45 165 30 30
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_RIGHT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: keep Aspect ratio|#A
+label: Clip to bounding box|#C
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: check_aspectratio
+name: check_clip
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 365 20 115 30
+box: 305 165 125 30
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Get LyX size|#L
+label: Get from file|#G
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: button_lyx_values
+name: button_getBB
 callback: C_FormBaseInputCB
 argument: 0
 
 =============== FORM ===============
-Name: form_graphics_bbox
+Name: form_graphics_extra
 Width: 500
 Height: 245
-Number of Objects: 11
+Number of Objects: 8
 
 --------------------
 class: FL_BOX
@@ -697,663 +625,129 @@ name:
 callback: 
 argument: 
 
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 10 10 480 180
-boxtype: FL_UP_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Corner coordinates (X, Y)
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 195 110 30 25
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: ,
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 195 55 30 25
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
-style: FL_BOLD_STYLE
-size: FL_NORMAL_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: 150 45 50 30
+box: 120 170 370 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: Top right  ( |#T
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_bb_x1
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 220 45 50 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_RIGHT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label:  )
+label: LaTeX options|#L
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: input_bb_y1
+name: input_special
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 150 95 50 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
+class: FL_LABELFRAME
+type: ENGRAVED_FRAME
+box: 10 15 480 60
+boxtype: FL_NO_BOX
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Bottom left  ( |#B
+label: Rotation
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: input_bb_x0
-callback: C_FormBaseInputCB
-argument: 0
+name: 
+callback: 
+argument: 
 
 --------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 220 95 50 30
-boxtype: FL_DOWN_BOX
+class: FL_TEXT
+type: NORMAL_TEXT
+box: 155 30 38 30
+boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_RIGHT
+alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label:  )
+label: deg
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: input_bb_y0
-callback: C_FormBaseInputCB
-argument: 0
+name: 
+callback: 
+argument: 
 
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 350 70 45 30
+box: 300 30 118 28
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Units|#U
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: choice_bb_units
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 20 150 165 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Get values from file|#G
+label: Origin|#O
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: button_getBB
+name: choice_origin
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 20 200 30 30
+box: 10 115 30 30
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_RIGHT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Clip to bounding box|#C
+label: Subfigure|#S
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: check_clip
+name: check_subcaption
 callback: C_FormBaseInputCB
 argument: 0
 
-=============== FORM ===============
-Name: form_graphics_special
-Width: 500
-Height: 245
-Number of Objects: 2
-
---------------------
-class: FL_BOX
-type: FLAT_BOX
-box: 0 0 500 245
-boxtype: FL_FLAT_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_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
 --------------------
 class: FL_INPUT
-type: NORMAL_INPUT
-box: 190 40 265 30
+type: INT_INPUT
+box: 100 30 55 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: Additional LaTeX options|#L
+label: Angle|#A
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: input_special
+name: input_rotate_angle
 callback: C_FormBaseInputCB
 argument: 0
 
-=============== FORM ===============
-Name: form_graphics_lyxview
-Width: 500
-Height: 245
-Number of Objects: 24
-
---------------------
-class: FL_BOX
-type: FLAT_BOX
-box: 0 0 500 245
-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: 155 10 335 225
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 120 115 370 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: Screen size
+label: 
 shortcut: 
-resize: FL_RESIZE_ALL
+resize: FL_RESIZE_NONE
 gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 355 10 135 50
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 10 10 145 225
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Screen display
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 350 75 70 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: Value|#V
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_lyxscale
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-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_NORMAL_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 170 25 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Original size|#O
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_lyxasis
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 170 75 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Scale|#S
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_lyxscale
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 170 140 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Custom|#u
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_lyxwh
-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_NORMAL_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 420 75 25 30
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_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: 
-callback: 
-argument: 
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 20 25 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Default|#f
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_pref
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 20 65 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Monochrome|#M
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_mono
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 20 105 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Grayscale|#G
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_gray
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 20 145 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Color|#C
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_color
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 20 185 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Don't display|#D
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_nodisplay
-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_INPUT
-type: NORMAL_INPUT
-box: 350 135 70 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: 425 135 50 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: choice_lyxwidth
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 350 170 70 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: 425 170 50 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: choice_lyxheight
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 365 20 115 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Get LaTeX size|#L
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: button_latex_values
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 210 200 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_RIGHT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: keep Aspect ratio|#A
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: check_lyxaspectratio
+name: input_subcaption
 callback: C_FormBaseInputCB
 argument: 0
 
index 0c1349926af276c9492c39af25c2412501749403..b4c25e08283e74d87df006af3decbec05bdeb502 100644 (file)
@@ -278,10 +278,12 @@ void xformsImage::clip(Params const & params)
                // Bounds are unchanged.
                return;
 
-       int const xoffset_l = std::max(0, params.bb.xl);
-       int const xoffset_r = std::max(0, image_->w - params.bb.xr);
-       int const yoffset_t = std::max(0, image_->h - params.bb.yt);
-       int const yoffset_b = std::max(0, params.bb.yb);
+       // FIXME: these values are unsigned so this makes NO sense
+       int const xoffset_l = std::max(0U, params.bb.xl);
+       int const xoffset_r = std::max(0U, image_->w - params.bb.xr);
+       int const yoffset_t = std::max(0U, image_->h - params.bb.yt);
+       int const yoffset_b = std::max(0U, params.bb.yb);
 
        flimage_crop(image_, xoffset_l, yoffset_t, xoffset_r, yoffset_b);
 }
index 17c60e8a654ab2fea6bd152b5444d34c53f140c7..f247e47c848e3f9df5ef4f23025a7121ab6b4bbe 100644 (file)
@@ -1,3 +1,11 @@
+2002-08-23  Rob Lahaye  <lahaye@snu.ac.kr>
+
+       * GraphicsImage.C:
+       * GraphicsParams.[Ch]: remove keepLyXAspectRatio, width and height
+       because this input has gone from the graphics dialog.
+       
+       * GraphicsTypes.h: add enum DisplayType DefaultDisplay
+
 2002-08-20  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
        * GraphicsImageXPM.h: inlcude boost/shared_ptr.hpp, remove include
index 8b5be6fae04f28fd04f87d5f6282b138de032c3c..96052c708ef91324cdb3a68673679fb76755195e 100644 (file)
@@ -34,70 +34,23 @@ boost::function0<Image::FormatList> Image::loadableFormats;
 std::pair<unsigned int, unsigned int>
 Image::getScaledDimensions(Params const & params) const
 {
+       unsigned int width = getWidth();
+       unsigned int height = getHeight();
+
+       // scale only when value makes sense, i.e. not zero
+       if (params.scale) {
+               width  = (width * params.scale) / 100;
+               height = (height * params.scale) / 100;
+       }
+
        lyxerr[Debug::GRAPHICS]
                << "GraphicsImage::getScaledDImensions()"
                << "\n\tparams.scale       : " << params.scale
-               << "\n\tparams.width       : " << params.width
-               << "\n\tparams.height      : " << params.height
-               << "\n\tkeepLyXAspectRatio : " << params.keepLyXAspectRatio
+               << "\n\twidth              : " << width
+               << "\n\theight             : " << height
                << std::endl;
-       if (params.width == 0 && params.height == 0 && params.scale == 0) {
-               // original size or scale/custom without any input
-               lyxerr[Debug::GRAPHICS]
-                       << "\treturn with the original values!\n";
-               return std::make_pair(getWidth(), getHeight());
-       }
-       
-       typedef unsigned int dimension;
-       dimension width  = 0;
-       dimension height = 0;
-       if (params.scale != 0) {
-               // GraphicsParams::Scale 
-               width  = dimension(double(getWidth())  * params.scale / 100.0);
-               height = dimension(getHeight() * params.scale / 100.0);
-               return std::make_pair(width, height);
-       } 
-       // GraphicsParams::WH
-       width  = (params.width > 0) ? params.width : getWidth();
-       height = (params.height > 0) ? params.height : getHeight(); 
-       if (!params.keepLyXAspectRatio)
-               return std::make_pair(width, height);
 
-       // calculate aspect ratio
-       float const rw  = getWidth();
-       float const rh = getHeight();
-       // there must be a width for the division
-       float const ratio = (rw > 0.001) ? rh/rw : 1.0;
-       lyxerr[Debug::GRAPHICS]
-               << "\tValue of LyXAspectRatio: " << ratio << std::endl;
-       // there are now four different cases
-       // w=0 & h=0 -> see above, no more possible at this place
-       // w>0 & h=0 -> calculate h
-       // w=0 & h>0 -> calculate w
-       // w>0 & h>0 -> the greatest difference to the original
-       //              value becomes the same
-       if (params.width > 0 && params.height > 0) {
-               // both widths are given and keepAspectRatio, too
-               int const diff_width = abs(int(getWidth() - params.width));
-               int const diff_height= abs(int(getHeight() - params.height));
-               if (diff_width > diff_height)
-                       height = int(ratio * params.width);
-               else
-                       width = int(ratio * params.height);
-               return std::make_pair(width, height);
-       }
-       if (params.width > 0) {
-               width = params.width;
-               height = int(ratio * params.width);
-               return std::make_pair(width, height);
-       }
-       if (params.height > 0) {
-               height = params.height;
-               width = int(ratio * params.height);
-               return std::make_pair(width, height);
-       }
-       // all other cases ... kind of paranoia :-)
-       return std::make_pair(getWidth(), getHeight());
+       return std::make_pair(width, height);
 }
 
 } // namespace grfx
index 896332759edf9b0816095a837c629f43a3224102..aad6885a7503675cf06674c513cf6260b8116a15 100644 (file)
@@ -24,24 +24,18 @@ namespace grfx {
 
 Params::Params()
        : display(ColorDisplay),
-         width(0),
-         height(0),
-         scale(0),
-         keepLyXAspectRatio(false),
+         scale(100),
          angle(0)
 {}
 
 
 bool operator==(Params const & a, Params const & b)
 {
-       return (a.filename           == b.filename &&
-               a.display            == b.display &&
-               a.bb                 == b.bb &&
-               a.width              == b.width &&
-               a.height             == b.height &&
-               a.scale              == b.scale &&
-               a.keepLyXAspectRatio == b.keepLyXAspectRatio &&
-               a.angle              == b.angle);
+       return (a.filename == b.filename &&
+               a.display == b.display &&
+               a.bb == b.bb &&
+               a.scale == b.scale &&
+               a.angle == b.angle);
 }
 
 
@@ -68,10 +62,10 @@ BoundingBox::BoundingBox(string const & bb)
 
        // inBP returns the length in Postscript points.
        // Note further that there are 72 Postscript pixels per inch.
-       int const xl_tmp = abs(LyXLength(a).inBP());
-       int const yb_tmp = abs(LyXLength(b).inBP());
-       int const xr_tmp = abs(LyXLength(c).inBP());
-       int const yt_tmp = abs(LyXLength(d).inBP());
+       unsigned int const xl_tmp = abs(LyXLength(a).inBP());
+       unsigned int const yb_tmp = abs(LyXLength(b).inBP());
+       unsigned int const xr_tmp = abs(LyXLength(c).inBP());
+       unsigned int const yt_tmp = abs(LyXLength(d).inBP());
 
        if (xr_tmp <= xl_tmp || yt_tmp <= yb_tmp)
                return;
index 302125344c00063f3f0c688dd40f7ba483a97f38..fbba4d1a1c1a327cf262a9da640da4f7608503e3 100644 (file)
@@ -34,10 +34,10 @@ struct BoundingBox {
        /// 0 0 0 0 is empty!
        bool empty() const;
 
-       int xl;
-       int yb;
-       int xr;
-       int yt;
+       unsigned int xl;
+       unsigned int yb;
+       unsigned int xr;
+       unsigned int yt;
 };
 
 bool operator==(BoundingBox const &, BoundingBox const &);
@@ -48,6 +48,7 @@ struct Params
        Params();
 
        DisplayType display;
+       unsigned int scale;
 
        /// The image filename.
        string filename;
@@ -61,13 +62,8 @@ struct Params
        /** The size of the view inside lyx in pixels or the scaling of the
         *  image.
         */
-       unsigned int width;
-       unsigned int height;
-       unsigned int scale;
-       bool keepLyXAspectRatio;
-
        /// Rotation angle.
-       int angle;
+       float angle;
 };
 
 bool operator==(Params const &, Params const &);
index ee9923654a394d9d87f4b5fd4c636ec8c7b69752..053bcae5279926035618c04b512a0d2ebe4c5357 100644 (file)
@@ -50,11 +50,13 @@ namespace grfx {
        /// How is the image to be displayed on the LyX screen?
        enum DisplayType {
                ///
-               ColorDisplay,
+               DefaultDisplay,
+               ///
+               MonochromeDisplay,
                ///
                GrayscaleDisplay,
                ///
-               MonochromeDisplay,
+               ColorDisplay,
                ///
                NoDisplay
        };
index 2cac4e252215c2523136992f0eefd0294c30ccd8..5b1960aca92baa80fbcb4183cc56864411768cec 100644 (file)
@@ -56,7 +56,7 @@ void InsetFootlike::write(Buffer const * buf, ostream & os) const
 bool InsetFootlike::insetAllowed(Inset::Code code) const
 {
        if ((code == Inset::FOOT_CODE) || (code == Inset::MARGIN_CODE)
-           || (code ==Inset::FLOAT_CODE))
+           || (code == Inset::FLOAT_CODE))
                return false;
        return InsetCollapsable::insetAllowed(code);
 }
index 7085b0c5cba9b7b59ad6a1d21ac3e5c6ff9c5347..b4ddabebc42df55112da926b5d87a6e3f616ea8c 100644 (file)
@@ -391,7 +391,7 @@ Inset::EDITABLE InsetGraphics::editable() const
 
 void InsetGraphics::write(Buffer const *, ostream & os) const
 {
-       os << "Graphics FormatVersion " << VersionNumber << '\n';
+       os << "Graphics\n";
        params().Write(os);
 }
 
@@ -402,10 +402,8 @@ void InsetGraphics::read(Buffer const * buf, LyXLex & lex)
 
        if (token == "Graphics")
                readInsetGraphics(lex);
-       else if (token == "Figure") // Compatibility reading of FigInset figures.
-               readFigInset(lex);
        else
-               lyxerr[Debug::GRAPHICS] << "Not a Graphics or Figure inset!\n";
+               lyxerr[Debug::GRAPHICS] << "Not a Graphics inset!\n";
 
        cache_->update(MakeAbsPath(params().filename, buf->filePath()));
 }
@@ -445,105 +443,6 @@ void InsetGraphics::readInsetGraphics(LyXLex & lex)
        }
 }
 
-// FormatVersion < 1.0  (LyX < 1.2)
-void InsetGraphics::readFigInset(LyXLex & lex)
-{
-       std::vector<string> const oldUnitsWidth =
-               getVectorFromString("pt, cm, in, text%, col%");
-       std::vector<string> const oldUnitsHeight =
-               getVectorFromString("pt, cm, in, theight%");
-       bool finished = false;
-       // set the display default
-       if (lyxrc.display_graphics == "mono")
-           params_.display = InsetGraphicsParams::MONOCHROME;
-       else if (lyxrc.display_graphics == "gray")
-           params_.display = InsetGraphicsParams::GRAYSCALE;
-       else if (lyxrc.display_graphics == "color")
-           params_.display = InsetGraphicsParams::COLOR;
-       else
-           params_.display = InsetGraphicsParams::NONE;
-       while (lex.isOK() && !finished) {
-               lex.next();
-
-               string const token = lex.getString();
-               lyxerr[Debug::GRAPHICS] << "Token: " << token << endl;
-
-               if (token.empty())
-                       continue;
-               else if (token == "\\end_inset") {
-                       finished = true;
-               } else if (token == "file") {
-                       if (lex.next()) {
-                               params_.filename = lex.getString();
-                       }
-               } else if (token == "extra") {
-                       if (lex.next());
-                       // kept for backwards compability. Delete in 0.13.x
-               } else if (token == "subcaption") {
-                       if (lex.eatLine())
-                               params_.subcaptionText = lex.getString();
-               } else if (token == "label") {
-                       if (lex.next());
-                       // kept for backwards compability. Delete in 0.13.x
-               } else if (token == "angle") {
-                       if (lex.next()) {
-                               params_.rotate = true;
-                               params_.rotateAngle = lex.getFloat();
-                       }
-               } else if (token == "size") {
-                       if (lex.next())
-                               params_.lyxwidth = LyXLength(lex.getString()+"pt");
-                       if (lex.next())
-                               params_.lyxheight = LyXLength(lex.getString()+"pt");
-                       params_.lyxsize_kind = InsetGraphicsParams::WH;
-               } else if (token == "flags") {
-                       if (lex.next())
-                               switch (lex.getInteger()) {
-                               case 1: params_.display = InsetGraphicsParams::MONOCHROME;
-                                   break;
-                               case 2: params_.display = InsetGraphicsParams::GRAYSCALE;
-                                   break;
-                               case 3: params_.display = InsetGraphicsParams::COLOR;
-                                   break;
-                               case 8: params_.display = InsetGraphicsParams::NONE;
-                                   break;
-                               }
-               } else if (token == "subfigure") {
-                       params_.subcaption = true;
-               } else if (token == "width") {
-                   if (lex.next()) {
-                       int i = lex.getInteger();
-                       if (lex.next()) {
-                           if (i == 5) {
-                               params_.scale = lex.getInteger();
-                               params_.size_kind = InsetGraphicsParams::SCALE;
-                           } else {
-                               string const value = lex.getString();
-                               lyxerr[Debug::GRAPHICS] << "readFiginset::oldWidth: "
-                                       << value << oldUnitsWidth[i] << endl;
-                               params_.width = LyXLength(value + oldUnitsWidth[i]);
-                               lyxerr[Debug::GRAPHICS] << "readFiginset::newWidth: "
-                                       << params_.width.asString() << endl;
-                               params_.size_kind = InsetGraphicsParams::WH;
-                           }
-                       }
-                   }
-               } else if (token == "height") {
-                   if (lex.next()) {
-                       int i = lex.getInteger();
-                       if (lex.next()) {
-                               string const value = lex.getString();
-                               lyxerr[Debug::GRAPHICS] << "readFiginset::oldHeight: "
-                                       << value << oldUnitsHeight[i] << endl;
-                               params_.height = LyXLength(value + oldUnitsHeight[i]);
-                               lyxerr[Debug::GRAPHICS] << "readFiginset::newHeight: "
-                                       << params_.height.asString() << endl;
-                           params_.size_kind = InsetGraphicsParams::WH;
-                       }
-                   }
-               }
-       }
-}
 
 string const InsetGraphics::createLatexOptions() const
 {
@@ -557,20 +456,22 @@ string const InsetGraphics::createLatexOptions() const
            options << "  draft,\n";
        if (params().clip)
            options << "  clip,\n";
-       if (params().size_kind == InsetGraphicsParams::WH) {
-           if (!params().width.zero())
-               options << "  width=" << params().width.asLatexString() << ",\n";
-           if (!params().height.zero())
-               options << "  height=" << params().height.asLatexString() << ",\n";
-       } else if (params().size_kind == InsetGraphicsParams::SCALE) {
-           if (params().scale > 0)
-               options << "  scale=" << double(params().scale)/100.0 << ",\n";
+       
+       if (params().scale) {
+               if (params().scale != 100)
+                       options << "  scale=" << params().scale / 100.0 << ",\n";
+       } else {
+               if (!params().width.zero())
+                       options << "  width=" << params().width.asLatexString() << ",\n";
+               if (!params().height.zero())
+                       options << "  height=" << params().height.asLatexString() << ",\n";
+               if (params().keepAspectRatio)
+                       options << "  keepaspectratio,\n";
        }
-       if (params().keepAspectRatio)
-           options << "  keepaspectratio,\n";
-       // 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) && params().rotate) {
+
+       // Make sure rotation angle is 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 << ",\n";
            if (!params().rotateOrigin.empty()) {
                options << "  origin=" << params().rotateOrigin[0];
@@ -583,8 +484,10 @@ string const InsetGraphics::createLatexOptions() const
                options << ",\n";
            }
        }
+
        if (!params().special.empty())
            options << params().special << ",\n";
+
        string opts = options.str().c_str();
        return opts.substr(0,opts.size()-2);    // delete last ",\n"
 }
index ccbdf709a35e570520ff8b7691f724e09fa3ec34..56fd64cfc18441bb2c641fd858eb16436b4fa13c 100644 (file)
@@ -108,8 +108,6 @@ private:
 
        /// Read the inset native format
        void readInsetGraphics(LyXLex & lex);
-       /// Read the FigInset file format
-       void readFigInset(LyXLex & lex);
 
        /// Get the status message, depends on the image loading status.
        string const statusMessage() const;
index 3445086b61b3b2715e19b5cb6694d1b6f7be202e..eb7d423074722edcd4d85b9edd43b99580420730 100644 (file)
@@ -41,8 +41,8 @@ bool translatorsSet = false;
 
 /// This is the translator between the Display enum and corresponding lyx
 /// file strings.
-Translator< InsetGraphicsParams::DisplayType, string >
-displayTranslator(InsetGraphicsParams::DEFAULT, "default");
+Translator< grfx::DisplayType, string >
+displayTranslator(grfx::DefaultDisplay, "default");
 
 } // namespace anon
 
@@ -54,15 +54,19 @@ InsetGraphicsParams::InsetGraphicsParams()
        if (! translatorsSet) {
                translatorsSet = true;
                // Fill the display translator
-               displayTranslator.addPair(DEFAULT, "default");
-               displayTranslator.addPair(MONOCHROME, "monochrome");
-               displayTranslator.addPair(GRAYSCALE, "grayscale");
-               displayTranslator.addPair(COLOR, "color");
-               displayTranslator.addPair(NONE, "none");
+               displayTranslator.addPair(grfx::DefaultDisplay, "default");
+               displayTranslator.addPair(grfx::MonochromeDisplay, "monochrome");
+               displayTranslator.addPair(grfx::GrayscaleDisplay, "grayscale");
+               displayTranslator.addPair(grfx::ColorDisplay, "color");
+               displayTranslator.addPair(grfx::NoDisplay, "none");
+               
+               // backward compatibility for old lyxrc.display_graphics
+               displayTranslator.addPair(grfx::MonochromeDisplay, "mono");
+               displayTranslator.addPair(grfx::GrayscaleDisplay, "gray");
+               displayTranslator.addPair(grfx::NoDisplay, "no");
        }
 }
 
-
 InsetGraphicsParams::InsetGraphicsParams(InsetGraphicsParams const & igp)
 {
        // I decided to skip the initialization since the copy will overwrite
@@ -84,52 +88,44 @@ InsetGraphicsParams::operator=(InsetGraphicsParams const & params)
 void InsetGraphicsParams::init()
 {
        subcaptionText = filename = string();
-       bb = string();                  // bounding box
-       draft = false;                  // draft mode
-       clip = false;                   // clip image
-       display = DEFAULT;              // see pref
-       subcaption = false;             // subfigure
-       noUnzip = false;                // unzip files
-       width = LyXLength();            // set to 0pt
+       lyxscale = 100;                 // lyx scaling in percentage
+       display = grfx::DefaultDisplay; // see pref
+       scale = 100;                    // output scaling in percentage
+       width = LyXLength();
        height = LyXLength();
-       lyxwidth = LyXLength();         // for the view in lyx
-       lyxheight = LyXLength();        // also set to 0pt
-       scale = 0;                      // unit is %
-       lyxscale = 0;                   // same for lyxview
-       size_kind = DEFAULT_SIZE;       // do nothing
-       lyxsize_kind = DEFAULT_SIZE;    // do nothing
        keepAspectRatio = false;        // for latex
-       keepLyXAspectRatio = false;     // for lyx
-       rotate = false;                 // Rotating
+       draft = false;                  // draft mode
+       noUnzip = false;                // unzip files
+
+       bb = string();                  // bounding box
+       clip = false;                   // clip image
+
        rotateOrigin = "leftBaseline";  // Origin
        rotateAngle = 0.0;              // in degrees
+       subcaption = false;             // subfigure
+       subcaptionText = string();      // subfigure caption
        special = string();             // userdefined stuff
 }
 
 void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
 {
        filename = igp.filename;
-       bb = igp.bb;
-       draft = igp.draft;
-       clip = igp.clip;
+       lyxscale = igp.lyxscale;
        display = igp.display;
-       subcaption = igp.subcaption;
-       subcaptionText = igp.subcaptionText;
-       noUnzip = igp.noUnzip;
-       keepAspectRatio = igp.keepAspectRatio;
+       scale = igp.scale;
        width = igp.width;
        height = igp.height;
-       scale = igp.scale;
-       size_kind = igp.size_kind;
-       lyxsize_kind = igp.lyxsize_kind;
-       lyxwidth = igp.lyxwidth;
-       lyxheight = igp.lyxheight;
-       keepLyXAspectRatio = igp.keepLyXAspectRatio;
-       lyxscale = igp.lyxscale;
-       keepLyXAspectRatio = igp.keepLyXAspectRatio;
-       rotate = igp.rotate;
-       rotateOrigin = igp.rotateOrigin;
+       keepAspectRatio = igp.keepAspectRatio;
+       draft = igp.draft;
+       noUnzip = igp.noUnzip;
+
+       bb = igp.bb;
+       clip = igp.clip;
+
        rotateAngle = igp.rotateAngle;
+       rotateOrigin = igp.rotateOrigin;
+       subcaption = igp.subcaption;
+       subcaptionText = igp.subcaptionText;
        special = igp.special;
 }
 
@@ -137,29 +133,25 @@ 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.lyxscale == right.lyxscale &&
            left.display == right.display &&
-           left.subcaption == right.subcaption &&
-           left.noUnzip == right.noUnzip &&
-           left.subcaptionText == right.subcaptionText &&
-           left.keepAspectRatio == right.keepAspectRatio &&
+           left.scale == right.scale &&
            left.width == right.width &&
            left.height == right.height &&
-           left.scale == right.scale &&
-           left.size_kind == right.size_kind &&
-           left.lyxsize_kind == right.lyxsize_kind &&
-           left.lyxwidth == right.lyxwidth &&
-           left.lyxheight == right.lyxheight &&
-           left.keepLyXAspectRatio == right.keepLyXAspectRatio &&
-           left.lyxscale == right.lyxscale &&
-           left.keepLyXAspectRatio == right.keepLyXAspectRatio &&
-           left.rotate == right.rotate &&
+           left.keepAspectRatio == right.keepAspectRatio &&
+           left.draft == right.draft &&
+           left.noUnzip == right.noUnzip &&
+
+
+           left.bb == right.bb &&
+           left.clip == right.clip &&
+
+           lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001) &&
            left.rotateOrigin == right.rotateOrigin &&
-           lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 &&
-                            left.special == right.special)
-               )
+           left.subcaption == right.subcaption &&
+           left.subcaptionText == right.subcaptionText &&
+           left.special == right.special
+          )
                return true;
 
        return false;
@@ -171,99 +163,49 @@ bool operator!=(InsetGraphicsParams const & left,
        return  !(left == right);
 }
 
-
-namespace {
-
-InsetGraphicsParams::sizeKind getSizeKind(string const & str_in)
-{
-       if (str_in == "width_height")
-               return InsetGraphicsParams::WH;
-       if (str_in == "scale")
-               return InsetGraphicsParams::SCALE;
-
-       // all other like "original"
-       return InsetGraphicsParams::DEFAULT_SIZE;
-}
-
-
-string const getSizeKindStr(InsetGraphicsParams::sizeKind sK_in)
-{
-       if (sK_in == InsetGraphicsParams::SCALE)
-               return "scale";
-       if (sK_in == InsetGraphicsParams::WH)
-               return "width_height";
-
-       // all other like DEFAULT_SIZE"
-       return "original";
-}      
-
-// compatibility-stuff 1.20->1.3.0
-InsetGraphicsParams::sizeKind getSizeKind(int type)
-{
-       switch (type) {
-       case 1:
-               return InsetGraphicsParams::WH;
-
-       case 2:
-               return InsetGraphicsParams::SCALE;
-
-       case 0:
-       default:
-               return InsetGraphicsParams::DEFAULT_SIZE;
-       }
-}
-
-} //anon
-
-
 void InsetGraphicsParams::Write(ostream & os) const
 {
-       // If there is no filename, write nothing for it.
+       // Do not write the default values
+
        if (!filename.empty()) {
                os << "\tfilename " << filename << '\n';
        }
+       if (lyxscale != 100)
+               os << "\tlyxscale " << lyxscale << '\n';
+       if (display != grfx::DefaultDisplay)
+               os << "\tdisplay " << displayTranslator.find(display) << '\n';
+       if (scale) {
+               if (scale != 100)
+                       os << "\tscale " << scale << '\n';
+       } else {
+               if (!width.zero())
+                       os << "\twidth " << width.asString() << '\n';
+       }
+
+       if (!height.zero())
+               os << "\theight " << height.asString() << '\n';
+       if (keepAspectRatio)
+               os << "\tkeepAspectRatio\n";
+       if (draft)                      // draft mode
+               os << "\tdraft\n";
+       if (noUnzip)
+               os << "\tnoUnzip\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 for the view inside lyx
-       os << "\tdisplay " << displayTranslator.find(display) << '\n';
-       // Save the subcaption status
+
+       if (rotateAngle != 0.0)
+               os << "\trotateAngle " << rotateAngle << '\n';
+       if (rotateOrigin != "leftBaseline")
+               os << "\trotateOrigin " << rotateOrigin << '\n';
        if (subcaption)
                os << "\tsubcaption\n";
        if (!subcaptionText.empty())
                os << "\tsubcaptionText \"" << subcaptionText << '\"' << '\n';
-       if (noUnzip)
-               os << "\tnoUnzip\n";
-       os << "\tsize_kind " << getSizeKindStr(size_kind) << '\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 (rotate)
-               os << "\trotate\n";
-       if (rotateAngle != 0.0)
-               os << "\trotateAngle " << rotateAngle << '\n';
-       if (!rotateOrigin.empty())
-               os << "\trotateOrigin " << rotateOrigin << '\n';
        if (!special.empty())
                os << "\tspecial " << special << '\n';
-       // the values for the view in lyx
-       os << "\tlyxsize_kind " << getSizeKindStr(lyxsize_kind) << '\n';
-       if (!lyxwidth.zero())           // the lyx-viewsize
-               os << "\tlyxwidth " << lyxwidth.asString() << '\n';
-       if (!lyxheight.zero())
-               os << "\tlyxheight " << lyxheight.asString();
-       if (keepLyXAspectRatio)
-               os << "\tkeepLyXAspectRatio\n";
-       if (lyxscale != 0)
-               os << "\tlyxscale " << lyxscale << '\n';
 }
 
 
@@ -272,74 +214,57 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token)
        if (token == "filename") {
                lex.eatLine();
                filename = lex.getString();
-       } 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 == "lyxscale") {
+               lex.next();
+               lyxscale = lex.getInteger();
        } else if (token == "display") {
                lex.next();
                string const type = lex.getString();
                display = displayTranslator.find(type);
-       } else if (token == "subcaption") {
-               subcaption = true;
-       } else if (token == "subcaptionText") {
-               lex.next();
-               subcaptionText = lex.getString();
-       } else if (token == "noUnzip") {
-               noUnzip = true;
-       } else if (token == "size_kind")  {
-               lex.next();
-               size_kind = getSizeKind(lex.getString());
-       // compatibility-stuff 1.20->1.3.0
-       } else if (token == "size_type") {
+       } else if (token == "scale") {
                lex.next();
-               size_kind = getSizeKind(lex.getInteger());
+               scale = lex.getInteger();
        } else if (token == "width") {
                lex.next();
                width = LyXLength(lex.getString());
+               scale = 0;
        } else if (token == "height") {
                lex.next();
                height = LyXLength(lex.getString());
        } else if (token == "keepAspectRatio") {
                keepAspectRatio = true;
-       } else if (token == "scale") {
-               lex.next();
-               scale = lex.getInteger();
-       } else if (token == "rotate") {
-               rotate = true;
+       } else if (token == "draft") {
+               draft = true;
+       } else if (token == "noUnzip") {
+               noUnzip = true;
+       } 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 == "rotateAngle") {
                lex.next();
                rotateAngle = lex.getFloat();
        } else if (token == "rotateOrigin") {
                lex.next();
                rotateOrigin=lex.getString();
-       } else if (token == "lyxsize_kind") {
-               lex.next();
-               lyxsize_kind = getSizeKind(lex.getString());
-       // compatibility-stuff 1.20->1.3.0
-       } else if (token == "lyxsize_type") {
-               lex.next();
-               lyxsize_kind = getSizeKind(lex.getInteger());
-       } else if (token == "lyxwidth") {
-               lex.next();
-               lyxwidth = LyXLength(lex.getString());
-       } else if (token == "lyxheight") {
-               lex.next();
-               lyxheight = LyXLength(lex.getString());
-       } else if (token == "keepLyXAspectRatio") {
-               keepLyXAspectRatio = true;
-       } else if (token == "lyxscale") {
+       } else if (token == "subcaption") {
+               subcaption = true;
+       } else if (token == "subcaptionText") {
                lex.next();
-               lyxscale = lex.getInteger();
+               subcaptionText = lex.getString();
        } else if (token == "special") {
                lex.eatLine();
                special = lex.getString();
-       } else {        // If it's none of the above, its not ours.
+
+       // catch and ignore following two old-format tokens and their arguments.
+       // e.g. "size_kind scale" clashes with the setting of the "scale" keyword.
+       } else if (token == "size_kind" || token == "lyxsize_kind") {
+               lex.next();
+               lex.getString();
+       } else {        // If it's none of the above, it's not ours.
                return false;
        }
        return true;
@@ -349,16 +274,12 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token)
 grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const
 {
        grfx::Params pars;
-       pars.width    = 0;
-       pars.height   = 0;
-       pars.scale    = 0;
-       pars.keepLyXAspectRatio = false;
-       pars.angle    = 0;
        pars.filename = filename;
+       pars.scale = lyxscale;
+       pars.angle = rotateAngle;
 
-       if (!filepath.empty()) {
+       if (!filepath.empty())
                pars.filename = MakeAbsPath(pars.filename, filepath);
-       }
 
        if (clip) {
                pars.bb = bb;
@@ -367,20 +288,31 @@ grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const
                string const tmp = readBB_from_PSFile(filename);
                lyxerr[Debug::GRAPHICS] << "BB_from_File: " << tmp << std::endl;
                if (!tmp.empty()) {
-                       int const bb_orig_xl = strToInt(token(tmp, ' ', 0));
-                       int const bb_orig_yb = strToInt(token(tmp, ' ', 1));
+                       unsigned int const bb_orig_xl = strToInt(token(tmp, ' ', 0));
+                       unsigned int const bb_orig_yb = strToInt(token(tmp, ' ', 1));
 
-                       pars.bb.xl -= bb_orig_xl;
-                       pars.bb.xr -= bb_orig_xl;
-                       pars.bb.yb -= bb_orig_yb;
-                       pars.bb.yt -= bb_orig_yb;
+                       // new pars.bb values must be >= zero 
+                       if  (pars.bb.xl > bb_orig_xl)
+                               pars.bb.xl -= bb_orig_xl;
+                       else
+                               pars.bb.xl = 0;
+                       
+                       if (pars.bb.xr > bb_orig_xl)
+                               pars.bb.xr -= bb_orig_xl;
+                       else
+                               pars.bb.xr = 0;
+                               
+                       if (pars.bb.yb > bb_orig_yb)
+                               pars.bb.yb -= bb_orig_yb;
+                       else
+                               pars.bb.yb = 0;
+                               
+                       if (pars.bb.yt > bb_orig_yb)
+                               pars.bb.yt -= bb_orig_yb;
+                       else
+                               pars.bb.yt = 0;
                }
 
-               pars.bb.xl = std::max(0, pars.bb.xl);
-               pars.bb.xr = std::max(0, pars.bb.xr);
-               pars.bb.yb = std::max(0, pars.bb.yb);
-               pars.bb.yt = std::max(0, pars.bb.yt);
-
                // Paranoia check.
                int const width  = pars.bb.xr - pars.bb.xl;
                int const height = pars.bb.yt - pars.bb.yb;
@@ -393,50 +325,17 @@ grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const
                }
        }
        
-       if (rotate)
-               pars.angle = int(rotateAngle);
-
-       switch (display) {
-               case InsetGraphicsParams::NONE:
-                       pars.display = grfx::NoDisplay;
-               break;
-
-               case InsetGraphicsParams::MONOCHROME:
-                       pars.display = grfx::MonochromeDisplay;
-               break;
-
-               case InsetGraphicsParams::GRAYSCALE: 
-                       pars.display = grfx::GrayscaleDisplay;
-
-               case InsetGraphicsParams::COLOR:
-                       pars.display = grfx::ColorDisplay;
-               break;
-
-               default: {
-                       if (lyxrc.display_graphics == "mono")
-                               pars.display = grfx::MonochromeDisplay;
-                       else if (lyxrc.display_graphics == "gray")
-                               pars.display = grfx::GrayscaleDisplay;
-                       else if (lyxrc.display_graphics == "color")
-                               pars.display = grfx::ColorDisplay;
-                       else
-                               pars.display = grfx::NoDisplay;
-               }
-       }
+       string mode;
+       if (display != grfx::DefaultDisplay)
+               mode = displayTranslator.find(display);
+       else
+               mode = displayTranslator.find(lyxrc.display_graphics);
+       pars.display = displayTranslator.find(mode);
        
        // Override the above if we're not using a gui
        if (!lyxrc.use_gui) {
                pars.display = grfx::NoDisplay;
        }
 
-       if (lyxsize_kind == InsetGraphicsParams::SCALE) {
-               pars.scale = lyxscale;
-
-       } else if (lyxsize_kind == InsetGraphicsParams::WH) {
-               pars.width = lyxwidth.inBP();
-               pars.height = lyxheight.inBP();
-               pars.keepLyXAspectRatio = keepLyXAspectRatio;
-       }
-       
        return pars;
 }
index 63f25aedf3264209b156e6a932960c1630b5d01c..a3aafedb2ad7fb36b6bac980ff69f915339aa9d2 100644 (file)
@@ -17,6 +17,7 @@
 #pragma interface
 #endif
 
+#include "graphics/GraphicsTypes.h"
 #include "LString.h"
 #include "lyxlength.h"
 
@@ -29,64 +30,41 @@ namespace grfx {
 /// This struct holds all the parameters needed by insetGraphics.
 struct InsetGraphicsParams
 {
-       /// How do we display the image?
-       enum DisplayType {
-           DEFAULT,            // whatever is in lyxrc.display_graphics
-           COLOR,              // full color range
-           GRAYSCALE,          // 256 shades of gray
-           MONOCHROME,         // In black and white.
-           NONE                // only keep a frame in place.
-       };
-       ///
-       enum sizeKind {         // for latex and/or lyx
-           DEFAULT_SIZE,       // like none
-           SCALE,              // percentage value
-           WH                  // width/height values
-       };
        /// Image filename.
        string filename;
-       /// Do we have a subcaption?
-       bool subcaption;
-       /// The text of the subcaption.
-       string subcaptionText;
-       /// Do we rotate?
-       bool rotate;
-       /// Origin point of rotation
-       string rotateOrigin;
-       /// Rotation angle.
-       float rotateAngle;
-       /// clip image
-       bool clip;
+       /// Scaling the Screen inside Lyx
+       unsigned int lyxscale;
+       /// How to display the image inside LyX
+       grfx::DisplayType display;
+       /// Scaling for output (LaTeX)
+       unsigned int scale;
+       /// sizes for output (LaTeX)
+       LyXLength width;
+       ///
+       LyXLength height;
+       /// Keep the ratio between height and width when resizing.
+       bool keepAspectRatio;
        /// draft mode
        bool draft;
        /// what to do with zipped files
        bool noUnzip;
+
        /// The bounding box with "xLB yLB yRT yRT ", divided by a space!
        string bb;
-       /// Type of rescaling
-       sizeKind size_kind;
-       /// three possible values for rescaling (latex)
-       LyXLength width;
-       ///
-       LyXLength height;
-       ///
-       int scale;
-       /// Keep the ratio between height and width when resizing.
-       bool keepAspectRatio;
+       /// clip image
+       bool clip;
+
+       /// Rotation angle.
+       float rotateAngle;
+       /// Origin point of rotation
+       string rotateOrigin;
+       /// Do we have a subcaption?
+       bool subcaption;
+       /// The text of the subcaption.
+       string subcaptionText;
        /// any userdefined special command
        string special;
-       /// How to display the image inside lyx
-       DisplayType display;
-       /// the size for the view inside lyx
-       LyXLength lyxwidth;
-       /// Typ of the LyXView, same as for latex
-       sizeKind lyxsize_kind;
-       ///
-       LyXLength lyxheight;
-       /// Keep the ratio between lyxheight and lyxwidth when resizing.
-       bool keepLyXAspectRatio;
-       /// Typ of rescaling the Screen inside lyx
-       int lyxscale;
+
        ///
        InsetGraphicsParams();
        ///
index bb1ef5bfb2cd78b5f390952bd153d56857577a85..ad88fa8cca5eccedde0209a7c4b9cdb5665d1f71 100644 (file)
@@ -61,7 +61,7 @@ using std::endl;
 
 InsetMinipage::InsetMinipage(BufferParams const & bp)
        : InsetCollapsable(bp), pos_(center),
-         inner_pos_(inner_center), width_(100, LyXLength::PW)
+         inner_pos_(inner_center), width_(100, LyXLength::PCW)
 {
        setLabel(_("minipage"));
        LyXFont font(LyXFont::ALL_SANE);
index 1d93bac55086a5816c9e9bbc768ece4fe4bcb9a8..54548a9104cd555bfe21925d4b0174a7487acc52 100644 (file)
@@ -902,12 +902,11 @@ int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base,
        int count = 0;
        bool env = false;
 
-       LyXFont f = *this; // why do you need this?
-       f.reduce(base); // why isn't this just "reduce(base);" (Lgb)
-       // Because this function is const. Everything breaks if this
-       // method changes the font it represents. There is no speed penalty
-       // by using the temporary. (Asger)
-
+       // reduce the current font to changes against the base
+       // font (of the layout). We use a temporary for this to
+       // avoid changing this font instance, as that would break
+       LyXFont f = *this;
+       f.reduce(base);
 
        if (f.family() != INHERIT_FAMILY) {
                os << '}';
index c8e7c64cb059f7534402be3fe1cfe4cc73d8f352..94db59641bd2e94d1515c41056a9f31be494d936 100644 (file)
@@ -332,6 +332,10 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
        case LFUN_REDO:
                disable = buf->redostack.empty();
                break;
+       case LFUN_CUT:
+       case LFUN_COPY:
+               disable = !view()->getLyXText()->selection.set();
+               break;
 #ifndef HAVE_LIBAIKSAURUS
        case LFUN_THESAURUS_ENTRY:
                disable = true;
index fc6504ce4ddcfdfb8104a0ddcc4aae899d6df2f6..b9586b1c3bb5ef88d4ff211ae8d5bef251eb9a55 100644 (file)
@@ -61,27 +61,27 @@ string const LyXLength::asLatexString() const
 {
        ostringstream buffer;
        switch (unit_) {
-       case PW:
+       case PTW:
            buffer << abs(static_cast<int>(val_/100)) << "."
                   << abs(static_cast<int>(val_)%100) << "\\textwidth";
            break;
-       case PE:
+       case PCW:
            buffer << abs(static_cast<int>(val_/100)) << "."
                   << abs(static_cast<int>(val_)%100) << "\\columnwidth";
            break;
-       case PP:
+       case PPW:
            buffer << abs(static_cast<int>(val_/100)) << "."
                   << abs(static_cast<int>(val_)%100) << "\\paperwidth";
            break;
-       case PL:
+       case PLW:
            buffer << abs(static_cast<int>(val_/100)) << "."
                   << abs(static_cast<int>(val_)%100) << "\\linewidth";
            break;
-       case PH:
+       case PPH:
            buffer << abs(static_cast<int>(val_/100)) << "."
                   << abs(static_cast<int>(val_)%100) << "\\paperheight";
            break;
-       case TH:
+       case PTH:
            buffer << abs(static_cast<int>(val_/100)) << "."
                   << abs(static_cast<int>(val_)%100) << "\\textheight";
            break;
@@ -201,14 +201,14 @@ int LyXLength::inPixels(int default_width, int default_height) const
                // math mode
                result = zoom * val_ * default_height;
                break;
-       case LyXLength::PW: // Always % of workarea
-       case LyXLength::PE:
-       case LyXLength::PP:
-       case LyXLength::PL:
+       case LyXLength::PCW: // Always % of workarea
+       case LyXLength::PTW:
+       case LyXLength::PPW:
+       case LyXLength::PLW:
                result = val_ * default_width / 100;
                break;
-       case LyXLength::PH:
-       case LyXLength::TH:
+       case LyXLength::PTH:
+       case LyXLength::PPH:
                result = val_ * default_height / 100;
                break;
        case LyXLength::UNIT_NONE:
index 1d84408fbce3a65a297925d224c87ec36ec48394..93272d7429cb5e59ae3480d2604d6c207f2023ef 100644 (file)
@@ -36,12 +36,12 @@ public:
                EX, ///< Height of a small "x" for the current font.
                EM, ///< Width of capital "M" in current font.
                MU, ///< Math unit (18mu = 1em) for positioning in math mode
-               PW, ///< Percent of columnwidth
-               PE, ///< Percent of textwidth
-               PP, ///< Percent of pagewidth
-               PL, ///< Percent of linewidth
-               TH, ///< Percent of textheight          // Herbert 2002-05-16
-               PH, ///< Percent of paperheight         // Herbert 2002-05-16
+               PTW, //< Percent of TextWidth
+               PCW, //< Percent of ColumnWidth
+               PPW, //< Percent of PageWidth
+               PLW, //< Percent of LineWidth
+               PTH, //< Percent of TextHeight          // Herbert 2002-05-16
+               PPH, //< Percent of PaperHeight         // Herbert 2002-05-16
                UNIT_NONE ///< no unit
        };
 
index 809f71ee64d007d2a676e2ca3233df6ce5bbcf15..5fba5fd1348660fe57e42a31c7201575d4815008 100644 (file)
@@ -353,8 +353,13 @@ int LyXRC::read(string const & filename)
                        break;
 
                case RC_DISPLAY_GRAPHICS:
-                       if (lexrc.next())
+                       if (lexrc.next()) {
                                display_graphics = lexrc.getString();
+                               // backward compatibility
+                               if (display_graphics == "mono") display_graphics = "monochrome";
+                               else if (display_graphics == "gray") display_graphics = "grayscale";
+                               else if (display_graphics == "no") display_graphics = "none";
+                       }
                        break;
 
                case RC_KBMAP:
@@ -1045,7 +1050,7 @@ void LyXRC::output(ostream & os) const
        case RC_DISPLAY_GRAPHICS:
                if (display_graphics != system_lyxrc.display_graphics) {
                        os << "# Display graphics within LyX\n"
-                          << "# no|mono|gray|color\n"
+                          << "# monochrome|grayscale|color|none\n"
                           << "\\display_graphics " << display_graphics
                           << "\n";
                }
index 4b67dfa20d7efbcc3dd3c6c42117df4d64477ad9..41578aa46e5f0f12bbfae10c9f8469a64d125d1d 100644 (file)
@@ -105,7 +105,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
 
        // replace the paragraphs with the undo informations
 
-       Paragraph * tmppar3 = undo.par;
+       Paragraph * undopar = undo.par;
        undo.par = 0;   /* otherwise the undo destructor would
                           delete the paragraph */
 
@@ -113,17 +113,17 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
        // paragraph if there is any. This is not needed if we don't have
        // a paragraph before because then in is automatically done in the
        // function which assigns the first paragraph to an InsetText. (Jug)
-       Paragraph * tmppar4 = tmppar3;
-       if (tmppar4) {
+       Paragraph * lastundopar = undopar;
+       if (lastundopar) {
                Inset * in = 0;
                if (before)
                        in = before->inInset();
                else if (undo.number_of_inset_id >= 0)
                        in = bv->buffer()->getInsetFromID(undo.number_of_inset_id);
-               tmppar4->setInsetOwner(in);
-               while (tmppar4->next()) {
-                       tmppar4 = tmppar4->next();
-                       tmppar4->setInsetOwner(in);
+               lastundopar->setInsetOwner(in);
+               while (lastundopar->next()) {
+                       lastundopar = lastundopar->next();
+                       lastundopar->setInsetOwner(in);
                }
        }
 
@@ -137,7 +137,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
                        deletepar = before->next();
                else
                        deletepar = firstUndoParagraph(bv, undo.number_of_inset_id);
-               tmppar2 = tmppar3;
+               tmppar2 = undopar;
                while (deletepar && deletepar != behind) {
                        deletelist.push_back(deletepar);
                        tmppar = deletepar;
@@ -155,14 +155,14 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
        }
 
        // put the new stuff in the list if there is one
-       if (tmppar3) {
+       if (undopar) {
                if (before)
-                       before->next(tmppar3);
+                       before->next(undopar);
                else
                        bv->text->ownerParagraph(firstUndoParagraph(bv, undo.number_of_inset_id)->id(),
-                                                tmppar3);
+                                                undopar);
 
-               tmppar3->previous(before);
+               undopar->previous(before);
        } else {
                // We enter here on DELETE undo operations where we have to
                // substitue the second paragraph with the first if the removed
@@ -170,13 +170,15 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
                if (!before && behind) {
                        bv->text->ownerParagraph(firstUndoParagraph(bv, undo.number_of_inset_id)->id(),
                                                 behind);
-                       tmppar3 = behind;
+                       undopar = behind;
                }
        }
-       if (tmppar4) {
-               tmppar4->next(behind);
+
+       // thread the end of the undo onto the par in front if any
+       if (lastundopar) {
+               lastundopar->next(behind);
                if (behind)
-                       behind->previous(tmppar4);
+                       behind->previous(lastundopar);
        }
 
 
@@ -196,8 +198,8 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
 
        tmppar = bv->buffer()->getParFromID(undo.number_of_cursor_par);
        UpdatableInset* it = 0;
-       if (tmppar3)
-               it = static_cast<UpdatableInset*>(tmppar3->inInset());
+       if (undopar)
+               it = static_cast<UpdatableInset*>(undopar->inInset());
        if (it) {
                it->getLyXText(bv)->redoParagraphs(bv,
                                                   it->getLyXText(bv)->cursor,