here comes a total diff of my graphics stuff, which I posted more
than one time to the list in smaller pieces! It fixes several bugs.

If no one is interested then let it be ...

Herbert


-- 
http://www.lyx.org/help/
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.775
diff -u -r1.775 ChangeLog
--- src/ChangeLog       21 Jun 2002 11:35:39 -0000      1.775
+++ src/ChangeLog       24 Jun 2002 07:58:00 -0000
@@ -1,3 +1,8 @@
+2002-06-23  Herbert Voss  <[EMAIL PROTECTED]>
+ 
+       * lengthcommon.C:
+       * lyxlength.[Ch]: support vertical length for imahe scaling
+ 
 2002-06-21  John Levon  <[EMAIL PROTECTED]>
 
        * lyxrc.h:
Index: src/lengthcommon.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lengthcommon.C,v
retrieving revision 1.3
diff -u -r1.3 lengthcommon.C
--- src/lengthcommon.C  27 Mar 2002 12:27:17 -0000      1.3
+++ src/lengthcommon.C  24 Jun 2002 07:58:00 -0000
@@ -8,7 +8,8 @@
 char const * unit_name[num_units] = { 
        "sp", "pt", "bp", "dd", "mm", "pc", "cc", "cm",
        "in", "ex", "em", "mu", 
-       "text%",  "col%", "page%", "line%" };
+       "text%",  "col%", "page%", "line%",
+       "theight%", "pheight%" };
 
 
 LyXLength::UNIT unitFromString(string const & data)
Index: src/lyxlength.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxlength.C,v
retrieving revision 1.16
diff -u -r1.16 lyxlength.C
--- src/lyxlength.C     10 Jun 2002 07:57:36 -0000      1.16
+++ src/lyxlength.C     24 Jun 2002 07:58:00 -0000
@@ -47,7 +47,8 @@
                return subst(oldLength,"c%","col%");
                    
        } else if (oldLength.find("t%") != string::npos) {
-               if (oldLength.find("text%") != string::npos)
+               if (oldLength.find("text%") != string::npos ||
+                   oldLength.find("height%") != string::npos)
                    return oldLength;
                else
                    return subst(oldLength,"t%","text%");
@@ -113,6 +114,14 @@
            buffer << abs(static_cast<int>(val_/100)) << "."
                   << abs(static_cast<int>(val_)%100) << "\\linewidth";
            break;
+       case PH:
+           buffer << abs(static_cast<int>(val_/100)) << "."
+                  << abs(static_cast<int>(val_)%100) << "\\paperheight";
+           break;
+       case TH:
+           buffer << abs(static_cast<int>(val_/100)) << "."
+                  << abs(static_cast<int>(val_)%100) << "\\textheight";
+           break;
        default:
            buffer << val_ << unit_name[unit_]; // setw?
            break;
@@ -230,6 +239,10 @@
        case LyXLength::PP:
        case LyXLength::PL:
                result = val_ * default_width / 100;
+               break;
+       case LyXLength::PH:
+       case LyXLength::TH:
+               result = val_ * default_height / 100;
                break;
        case LyXLength::UNIT_NONE:
                result = 0;  // this cannot happen
Index: src/lyxlength.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxlength.h,v
retrieving revision 1.7
diff -u -r1.7 lyxlength.h
--- src/lyxlength.h     11 Apr 2002 18:36:18 -0000      1.7
+++ src/lyxlength.h     24 Jun 2002 07:58:00 -0000
@@ -36,10 +36,12 @@
                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 both "%" or "%c"
-               PE, ///< FIXME
+               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
                UNIT_NONE ///< no unit
        };
 
Index: src/frontends/controllers/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v
retrieving revision 1.191
diff -u -r1.191 ChangeLog
--- src/frontends/controllers/ChangeLog 21 Jun 2002 16:35:29 -0000      1.191
+++ src/frontends/controllers/ChangeLog 24 Jun 2002 07:58:00 -0000
@@ -1,3 +1,10 @@
+2002-06-23  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * ControlBibtex.C: 
+       * tex_helpers.C: test of existing file only in tex_helpers
+
+       * ControlGraphics.C: comments
+
 2002-06-21  Angus Leeming  <[EMAIL PROTECTED]>
 
        * tex_helpers.C: Use <vector> not <vector.h>. Reorder header files.
Index: src/frontends/controllers/ControlBibtex.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlBibtex.C,v
retrieving revision 1.18
diff -u -r1.18 ControlBibtex.C
--- src/frontends/controllers/ControlBibtex.C   21 Jun 2002 02:22:13 -0000      1.18
+++ src/frontends/controllers/ControlBibtex.C   24 Jun 2002 07:58:00 -0000
@@ -71,13 +71,7 @@
 
 string const ControlBibtex::getBibStyles() const
 {
-       string list = getTexFileList("bstFiles.lst", false);
-       // test, if we have a valid list, otherwise run rescan
-       if (list.empty()) {
-               rescanBibStyles();
-               list = getTexFileList("bstFiles.lst", false);
-       }
-       return list;
+       return getTexFileList("bstFiles.lst", false);
 }
 
 
Index: src/frontends/controllers/ControlGraphics.C
===================================================================
RCS file: 
/usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlGraphics.C,v
retrieving revision 1.42
diff -u -r1.42 ControlGraphics.C
--- src/frontends/controllers/ControlGraphics.C 18 Jun 2002 20:47:48 -0000      1.42
+++ src/frontends/controllers/ControlGraphics.C 24 Jun 2002 07:58:01 -0000
@@ -67,6 +67,7 @@
        // Set the parameters in the inset, it also returns true if the new
        // parameters are different from what was in the inset already.
        bool changed = inset()->setParams(params(), lv_.buffer()->filePath());
+
        // Tell LyX we've got a change, and mark the document dirty,
        // if it changed.
        lv_.view()->updateInset(inset(), changed);
@@ -104,10 +105,11 @@
 {
        string const abs_file = MakeAbsPath(file, lv_.buffer()->filePath());
 
-       string const from = getExtFromContents(abs_file);
-       // Check if we have a Postscript file, then it's easy
-       if (contains(from, "ps"))
-               return readBB_from_PSFile(abs_file);
+       // try to get it from the file, if possible. Zipped files are
+       // unzipped in the readBB_from_PSFile-Function
+       string const bb = readBB_from_PSFile(abs_file);
+       if (!bb.empty())
+               return bb;
 
        // we don't, so ask the Graphics Cache if it has loaded the file
        grfx::GCache & gc = grfx::GCache::get();
@@ -133,6 +135,7 @@
 // correspond to the LaTeX identifiers shown in the comments at the
 // 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
Index: src/frontends/controllers/tex_helpers.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/tex_helpers.C,v
retrieving revision 1.3
diff -u -r1.3 tex_helpers.C
--- src/frontends/controllers/tex_helpers.C     21 Jun 2002 16:35:29 -0000      1.3
+++ src/frontends/controllers/tex_helpers.C     24 Jun 2002 07:58:01 -0000
@@ -69,10 +69,11 @@
 
 string const getTexFileList(string const & filename, bool withFullPath)
 {
-       string const file = LibFileSearch("", filename);
-       if (file.empty())
-               return string();
- 
+       string file = LibFileSearch("", filename);
+       if (file.empty()) {
+               rescanTexStyles();
+               file = LibFileSearch("", filename);
+       }
        vector<string> dbase =
                getVectorFromString(GetFileContents(file), "\n");
 
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.437
diff -u -r1.437 ChangeLog
--- src/frontends/xforms/ChangeLog      21 Jun 2002 16:33:12 -0000      1.437
+++ src/frontends/xforms/ChangeLog      24 Jun 2002 07:58:02 -0000
@@ -1,3 +1,13 @@
+2002-06-23 Herbert Voss  <[EMAIL PROTECTED]>
+ 
+       * FormGraphics.C: Tooltips, 
+       to prevent misunderstandings changed of size_type to size_kind
+       support of vertical scaling
+       support of aspectration for the lyx-view
+
+       * forms/form_graphics.fd: adding a checkbutton for the lyxview
+       aspectratio
+ 
 2002-06-21  Angus Leeming  <[EMAIL PROTECTED]>
 
        * xscreen.C: add a using std::endl directive.
Index: src/frontends/xforms/FormGraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormGraphics.C,v
retrieving revision 1.72
diff -u -r1.72 FormGraphics.C
--- src/frontends/xforms/FormGraphics.C 13 Jun 2002 13:43:48 -0000      1.72
+++ src/frontends/xforms/FormGraphics.C 24 Jun 2002 07:58:02 -0000
@@ -18,6 +18,7 @@
 #include "FormGraphics.h"
 #include "forms/form_graphics.h"
 #include "Alert.h"
+#include "Tooltips.h"
 
 #include "xforms_helpers.h"
 #include "helper_funcs.h"
@@ -113,6 +114,33 @@
        bc().addReadOnly(file_->check_draft);
        bc().addReadOnly(file_->check_nounzip);
 
+       // set up the tooltips for the filesection
+       string str = _("The file you want to insert.");
+       tooltips().init(file_->input_filename, str);
+       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 = _("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");
+       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));
 
@@ -132,6 +160,47 @@
        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));
@@ -158,6 +227,35 @@
        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);
@@ -180,18 +278,45 @@
        bc().addReadOnly(bbox_->button_getBB);
        bc().addReadOnly(bbox_->check_clip);
 
+       // set up the tooltips for the bounding-box-section
+       str = _("The lower left x-value of the bounding box");
+       tooltips().init(bbox_->input_bb_x0, str);
+       str = _("The lower left y-value of the bounding box");
+       tooltips().init(bbox_->input_bb_y0, str);
+       str = _("The upper right x-value of the bounding box");
+       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");
+       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.");
+       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));
 
        fl_set_input_return (special_->input_special, FL_RETURN_CHANGED);
        setPrehandler(special_->input_special);
 
+       // 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);
+
        // 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);
+
        // set the right default unit
        if (lyxrc.default_papersize < 3)
                defaultUnit = "in";
@@ -239,11 +364,11 @@
                igp.display = InsetGraphicsParams::NONE;
 
        if (fl_get_button(lyxview_->radio_lyxasis))
-               igp.lyxsize_type = InsetGraphicsParams::DEFAULT_SIZE;
+               igp.lyxsize_kind = InsetGraphicsParams::DEFAULT_SIZE;
        else if (fl_get_button(lyxview_->radio_lyxwh))
-               igp.lyxsize_type = InsetGraphicsParams::WH;
+               igp.lyxsize_kind = InsetGraphicsParams::WH;
        else
-               igp.lyxsize_type = InsetGraphicsParams::SCALE;
+               igp.lyxsize_kind = InsetGraphicsParams::SCALE;
 
        igp.lyxwidth = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
                                               lyxview_->choice_lyxwidth);
@@ -252,14 +377,15 @@
                                                lyxview_->choice_lyxheight);
 
        igp.lyxscale = strToInt(getStringFromInput(lyxview_->input_lyxscale));
+       igp.keepLyXAspectRatio = fl_get_button(lyxview_->check_lyxaspectratio);
 
        // the size section
        if (fl_get_button(size_->radio_asis))
-               igp.size_type = InsetGraphicsParams::DEFAULT_SIZE;
+               igp.size_kind = InsetGraphicsParams::DEFAULT_SIZE;
        else if (fl_get_button(size_->radio_wh))
-               igp.size_type = InsetGraphicsParams::WH;
+               igp.size_kind = InsetGraphicsParams::WH;
        else
-               igp.size_type = InsetGraphicsParams::SCALE;
+               igp.size_kind = InsetGraphicsParams::SCALE;
 
        igp.width = getLyXLengthFromWidgets(size_->input_width,
                                            size_->choice_width);
@@ -354,7 +480,7 @@
        updateWidgetsFromLength(lyxview_->input_lyxheight,
                                lyxview_->choice_lyxheight, igp.lyxheight, 
defaultUnit);
        fl_set_input(lyxview_->input_lyxscale, tostr(igp.lyxscale).c_str());
-       switch (igp.lyxsize_type) {
+       switch (igp.lyxsize_kind) {
        case InsetGraphicsParams::DEFAULT_SIZE: {
                fl_set_button(lyxview_->radio_lyxasis,1);
                setEnabled(lyxview_->input_lyxwidth, 0);
@@ -364,15 +490,6 @@
                setEnabled(lyxview_->input_lyxscale, 0);
                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_->input_lyxscale, 0);
-               break;
-       }
        case InsetGraphicsParams::SCALE: {
                fl_set_button(lyxview_->radio_lyxscale, 1);
                setEnabled(lyxview_->input_lyxwidth, 0);
@@ -382,7 +499,17 @@
                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_->input_lyxscale, 0);
+               break;
+       }
        }
+       fl_set_button(lyxview_->check_lyxaspectratio, igp.keepLyXAspectRatio);
 
        // the size section
        // Update the draft and clip mode
@@ -391,7 +518,9 @@
        updateWidgetsFromLength(size_->input_height,
                                size_->choice_height, igp.height, defaultUnit);
        fl_set_input(size_->input_scale, tostr(igp.scale).c_str());
-       switch (igp.size_type) {
+       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);
@@ -402,16 +531,6 @@
                setEnabled(size_->input_scale, 0);
                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;
-       }
        case InsetGraphicsParams::SCALE: {
                fl_set_button(size_->radio_scale, 1);
                setEnabled(size_->input_width, 0);
@@ -422,6 +541,16 @@
                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);
 
@@ -530,23 +659,26 @@
                setEnabled(lyxview_->choice_lyxwidth, 0);
                setEnabled(lyxview_->input_lyxheight, 0);
                setEnabled(lyxview_->choice_lyxheight, 0);
-               setEnabled(lyxview_->input_lyxscale, 0);
-       } 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, 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),'%'))
                        Alert::alert(_("Warning!"),
-                                    _("The units text%, page%, col% and line% are not 
allowed here."),
+                                    _("All %-units are not allowed here."),
                                     _("Cannot use the values from LaTeX size!"));
                else {
                        LyXLength dummy =
@@ -569,13 +701,7 @@
                                setEnabled(lyxview_->choice_lyxwidth, 0);
                                setEnabled(lyxview_->input_lyxheight, 0);
                                setEnabled(lyxview_->choice_lyxheight, 0);
-                               setEnabled(lyxview_->input_lyxscale, 0);
-                       } 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, 0);
                                setEnabled(lyxview_->input_lyxscale, 0);
                        } else if (fl_get_button (size_->radio_scale) ==1) {
                                fl_set_button (lyxview_->radio_lyxscale, 1);
@@ -583,9 +709,20 @@
                                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_->input_lyxscale, 0);
+                               setEnabled(lyxview_->check_lyxaspectratio, 1);
                        }
                }
+               fl_set_button(lyxview_->check_lyxaspectratio,
+                       fl_get_button(size_->check_aspectratio));
 
                // the bb section
        } else if (!controller().bbChanged &&
@@ -622,13 +759,6 @@
                setEnabled(size_->choice_height, 0);
                setEnabled(size_->check_aspectratio, 0);
                setEnabled(size_->input_scale, 0);
-       } 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_->radio_scale) {
                setEnabled(size_->input_width, 0);
                setEnabled(size_->choice_width, 0);
@@ -636,6 +766,13 @@
                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);
@@ -657,14 +794,6 @@
                        setEnabled(size_->choice_height, 0);
                        setEnabled(size_->check_aspectratio, 0);
                        setEnabled(size_->input_scale, 0);
-               } 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);
                } else if (fl_get_button (lyxview_->radio_lyxscale) ==1) {
                        fl_set_button (size_->radio_scale, 1);
                        setEnabled(size_->input_width, 0);
@@ -673,7 +802,17 @@
                        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
Index: src/frontends/xforms/forms/form_graphics.fd
===================================================================
RCS file: 
/usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/form_graphics.fd,v
retrieving revision 1.29
diff -u -r1.29 form_graphics.fd
--- src/frontends/xforms/forms/form_graphics.fd 13 Jun 2002 13:43:51 -0000      1.29
+++ src/frontends/xforms/forms/form_graphics.fd 24 Jun 2002 07:58:03 -0000
@@ -442,7 +442,7 @@
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 0 0 0
+box: 0 10 10 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -453,7 +453,7 @@
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name:
+name: 
 callback: 
 argument: 
 
@@ -923,7 +923,7 @@
 Name: form_graphics_lyxview
 Width: 500
 Height: 245
-Number of Objects: 23
+Number of Objects: 24
 
 --------------------
 class: FL_BOX
@@ -1000,7 +1000,7 @@
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 350 95 70 30
+box: 350 75 70 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -1018,7 +1018,7 @@
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 0 0 0
+box: 0 10 10 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -1036,10 +1036,10 @@
 --------------------
 class: FL_ROUND3DBUTTON
 type: RADIO_BUTTON
-box: 255 25 30 30
+box: 170 25 30 30
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_LEFT
+alignment: FL_ALIGN_RIGHT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
@@ -1054,10 +1054,10 @@
 --------------------
 class: FL_ROUND3DBUTTON
 type: RADIO_BUTTON
-box: 255 90 30 30
+box: 170 75 30 30
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_LEFT
+alignment: FL_ALIGN_RIGHT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
@@ -1072,10 +1072,10 @@
 --------------------
 class: FL_ROUND3DBUTTON
 type: RADIO_BUTTON
-box: 255 155 30 30
+box: 170 140 30 30
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_LEFT
+alignment: FL_ALIGN_RIGHT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
@@ -1108,7 +1108,7 @@
 --------------------
 class: FL_TEXT
 type: NORMAL_TEXT
-box: 420 95 25 30
+box: 420 75 25 30
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
@@ -1126,7 +1126,7 @@
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 0 0 0
+box: 0 10 10 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -1137,7 +1137,7 @@
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name:
+name: 
 callback: 
 argument: 
 
@@ -1252,7 +1252,7 @@
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 350 155 70 30
+box: 350 135 70 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -1270,7 +1270,7 @@
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 425 155 50 30
+box: 425 135 50 30
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
@@ -1288,7 +1288,7 @@
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 350 190 70 30
+box: 350 170 70 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -1306,7 +1306,7 @@
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 425 190 50 30
+box: 425 170 50 30
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
@@ -1336,6 +1336,24 @@
 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
 callback: C_FormBaseInputCB
 argument: 0
 
Index: src/graphics/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/ChangeLog,v
retrieving revision 1.74
diff -u -r1.74 ChangeLog
--- src/graphics/ChangeLog      19 Jun 2002 10:39:57 -0000      1.74
+++ src/graphics/ChangeLog      24 Jun 2002 07:58:03 -0000
@@ -1,3 +1,8 @@
+2002-06-23  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * GraphicsConverter.C: (convert) fix bug with dots in the filebase.
+       Use of addExtension insetad of ChangeExtension
+               
 2002-06-19  Angus Leeming  <[EMAIL PROTECTED]>
 
        * GraphicsConverter.C: add using std::endl directive.
Index: src/graphics/GraphicsConverter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/GraphicsConverter.C,v
retrieving revision 1.7
diff -u -r1.7 GraphicsConverter.C
--- src/graphics/GraphicsConverter.C    19 Jun 2002 10:39:57 -0000      1.7
+++ src/graphics/GraphicsConverter.C    24 Jun 2002 07:58:03 -0000
@@ -117,8 +117,8 @@
                }
        }
 
-       string const to_file =
-               ChangeExtension(to_file_base, formats.extension(to_format));
+       string const to_file = 
+               addExtension(to_file_base, formats.extension(to_format));
 
        if (!success) {
                script_file = string();
@@ -182,8 +182,8 @@
        lyxerr[Debug::GRAPHICS] << "[GraphicsConverter::build_script] ... ";
        typedef Converters::EdgePath EdgePath;
 
-       string const to_file = ChangeExtension(to_file_base,
-                                              formats.extension(to_format));
+       string const to_file = 
+               addExtension(to_file_base, formats.extension(to_format));
 
        if (from_format == to_format) {
                script << move_file(QuoteName(from_file), QuoteName(to_file));
@@ -221,7 +221,7 @@
                // Build the conversion command
                string const infile      = outfile;
                string const infile_base = ChangeExtension(infile, string());
-               outfile = ChangeExtension(to_base, conv.To->extension());
+               outfile = addExtension(to_base, conv.To->extension());
 
                // Store these names in the shell script
                script << "infile="      << QuoteName(infile) << '\n'
Index: src/insets/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.447
diff -u -r1.447 ChangeLog
--- src/insets/ChangeLog        18 Jun 2002 20:47:49 -0000      1.447
+++ src/insets/ChangeLog        24 Jun 2002 07:58:04 -0000
@@ -1,3 +1,12 @@
+2002-06-23  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * insetgraphics.C (prepareFile):bugfix: return always
+       files without extension
+       * insetgraphicsparams.[Ch]: 
+       change name size_type to size_kind
+       add support of vertical scaling
+       fix bug with origin default
+
 2002-06-15  Herbert Voss  <[EMAIL PROTECTED]>
  
        * insetgraphics.C: (prepareFile) fix bug with zipped eps-files
Index: src/insets/insetgraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.118
diff -u -r1.118 insetgraphics.C
--- src/insets/insetgraphics.C  18 Jun 2002 20:47:49 -0000      1.118
+++ src/insets/insetgraphics.C  24 Jun 2002 07:58:04 -0000
@@ -441,8 +441,10 @@
 // FormatVersion < 1.0  (LyX < 1.2)
 void InsetGraphics::readFigInset(LyXLex & lex)
 {
-       std::vector<string> const oldUnits =
-               getVectorFromString("pt,cm,in,p%,c%");
+       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")
@@ -486,7 +488,7 @@
                                params_.lyxwidth = LyXLength(lex.getString()+"pt");
                        if (lex.next())
                                params_.lyxheight = LyXLength(lex.getString()+"pt");
-                       params_.lyxsize_type = InsetGraphicsParams::WH;
+                       params_.lyxsize_kind = InsetGraphicsParams::WH;
                } else if (token == "flags") {
                        if (lex.next())
                                switch (lex.getInteger()) {
@@ -496,6 +498,8 @@
                                    break;
                                case 3: params_.display = InsetGraphicsParams::COLOR;
                                    break;
+                               case 8: params_.display = InsetGraphicsParams::NONE;
+                                   break;
                                }
                } else if (token == "subfigure") {
                        params_.subcaption = true;
@@ -505,10 +509,15 @@
                        if (lex.next()) {
                            if (i == 5) {
                                params_.scale = lex.getInteger();
-                               params_.size_type = InsetGraphicsParams::SCALE;
+                               params_.size_kind = InsetGraphicsParams::SCALE;
                            } else {
-                               params_.width = LyXLength(lex.getString()+oldUnits[i]);
-                               params_.size_type = InsetGraphicsParams::WH;
+                               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;
                            }
                        }
                    }
@@ -516,8 +525,13 @@
                    if (lex.next()) {
                        int i = lex.getInteger();
                        if (lex.next()) {
-                           params_.height = LyXLength(lex.getString()+oldUnits[i]);
-                           params_.size_type = InsetGraphicsParams::WH;
+                               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;
                        }
                    }
                }
@@ -531,17 +545,17 @@
        // before writing it to the output stream.
        ostringstream options;
        if (!params().bb.empty())
-           options << "  bb=" << strip(params().bb) << ",\n";
+           options << "bb=" << strip(params().bb) << ",\n";
        if (params().draft)
            options << "  draft,\n";
        if (params().clip)
            options << "  clip,\n";
-       if (params().size_type == InsetGraphicsParams::WH) {
+       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_type == InsetGraphicsParams::SCALE) {
+       } else if (params().size_kind == InsetGraphicsParams::SCALE) {
            if (params().scale > 0)
                options << "  scale=" << double(params().scale)/100.0 << ",\n";
        }
@@ -702,7 +716,7 @@
                        if (!success) {
                                Alert::alert(_("Cannot copy file"), 
orig_file_with_path,
                                        _("into tempdir"));
-                               return orig_file;
+                               return RemoveExtension(orig_file);
                        }
                }
        }
@@ -714,7 +728,9 @@
                // No conversion is needed. LaTeX can handle the graphic file as is.
                // This is true even if the orig_file is compressed. We have to return
                // the orig_file_with_path, maybe it is a zipped one
-               return lyxrc.use_tempdir ? temp_file : orig_file_with_path;
+               if (lyxrc.use_tempdir)
+                       return RemoveExtension(temp_file);
+               return RemoveExtension(orig_file_with_path);
        }
        
        string const outfile_base = RemoveExtension(temp_file);
Index: src/insets/insetgraphicsParams.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphicsParams.C,v
retrieving revision 1.39
diff -u -r1.39 insetgraphicsParams.C
--- src/insets/insetgraphicsParams.C    29 May 2002 22:07:59 -0000      1.39
+++ src/insets/insetgraphicsParams.C    24 Jun 2002 07:58:05 -0000
@@ -94,11 +94,11 @@
        lyxheight = LyXLength();        // also set to 0pt
        scale = 0;                      // unit is %
        lyxscale = 0;                   // same for lyxview
-       size_type = DEFAULT_SIZE;       // do nothing
-       lyxsize_type = DEFAULT_SIZE;    // do nothing
+       size_kind = DEFAULT_SIZE;       // do nothing
+       lyxsize_kind = DEFAULT_SIZE;    // do nothing
        keepAspectRatio = false;        // only for latex
        rotate = false;                 // Rotating
-       rotateOrigin = "center";        // Origin
+       rotateOrigin = "leftBaseline";  // Origin
        rotateAngle = 0.0;              // in degrees
        special = string();             // userdefined stuff
 }
@@ -117,8 +117,8 @@
        width = igp.width;
        height = igp.height;
        scale = igp.scale;
-       size_type = igp.size_type;
-       lyxsize_type = igp.lyxsize_type;
+       size_kind = igp.size_kind;
+       lyxsize_kind = igp.lyxsize_kind;
        lyxwidth = igp.lyxwidth;
        lyxheight = igp.lyxheight;
        lyxscale = igp.lyxscale;
@@ -143,8 +143,8 @@
            left.width == right.width &&
            left.height == right.height &&
            left.scale == right.scale &&
-           left.size_type == right.size_type &&
-           left.lyxsize_type == right.lyxsize_type &&
+           left.size_kind == right.size_kind &&
+           left.lyxsize_kind == right.lyxsize_kind &&
            left.lyxwidth == right.lyxwidth &&
            left.lyxheight == right.lyxheight &&
            left.lyxscale == right.lyxscale &&
@@ -165,6 +165,34 @@
 }
 
 
+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";
+}      
+
+} //anon
+
+
 void InsetGraphicsParams::Write(ostream & os) const
 {
        // If there is no filename, write nothing for it.
@@ -186,11 +214,7 @@
                os << "\tsubcaptionText \"" << subcaptionText << '\"' << '\n';
        if (noUnzip)
                os << "\tnoUnzip\n";
-       // we always need the size type
-       // 0: no special
-       // 1: width/height combination
-       // 2: scale
-       os << "\tsize_type " <<  size_type << '\n';
+       os << "\tsize_kind " << getSizeKindStr(size_kind) << '\n';
        if (!width.zero())
                os << "\twidth " << width.asString() << '\n';
        if (!height.zero())
@@ -208,11 +232,13 @@
        if (!special.empty())
                os << "\tspecial " << special << '\n';
        // the values for the view in lyx
-       os << "\tlyxsize_type " <<  lyxsize_type << '\n';
+       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';
 }
@@ -243,19 +269,9 @@
                subcaptionText = lex.getString();
        } else if (token == "noUnzip") {
                noUnzip = true;
-       } else if (token == "size_type") {
+       } else if (token == "size_kind") {
                lex.next();
-               switch (lex.getInteger()) {
-               case 0:
-                       size_type = DEFAULT_SIZE;
-                       break;
-               case 1:
-                       size_type = WH;
-                       break;
-               case 2:
-                       size_type = SCALE;
-                       break;
-               }
+               size_kind = getSizeKind(lex.getString());
        } else if (token == "width") {
                lex.next();
                width = LyXLength(lex.getString());
@@ -275,25 +291,17 @@
        } else if (token == "rotateOrigin") {
                lex.next();
                rotateOrigin=lex.getString();
-       } else if (token == "lyxsize_type") {
+       } else if (token == "lyxsize_kind") {
                lex.next();
-               switch (lex.getInteger()) {
-               case 0:
-                       lyxsize_type = DEFAULT_SIZE;
-                       break;
-               case 1:
-                       lyxsize_type = WH;
-                       break;
-               case 2:
-                       lyxsize_type = SCALE;
-                       break;
-               }
+               lyxsize_kind = getSizeKind(lex.getString());
        } 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") {
                lex.next();
                lyxscale = lex.getInteger();
@@ -320,7 +328,7 @@
                pars.filename = MakeAbsPath(pars.filename, filepath);
        }
 
-       if (clip) {
+//     if (clip) {
                pars.bb = bb;
 
                // Get the original Bounding Box from the file
@@ -351,7 +359,7 @@
                        pars.bb.yb = 0;
                        pars.bb.yt = 0;
                }
-       }
+//     }
        
        if (rotate)
                pars.angle = int(rotateAngle);
@@ -385,10 +393,10 @@
                pars.display = grfx::GParams::NONE;
        }
 
-       if (lyxsize_type == InsetGraphicsParams::SCALE) {
+       if (lyxsize_kind == InsetGraphicsParams::SCALE) {
                pars.scale = lyxscale;
 
-       } else if (lyxsize_type == InsetGraphicsParams::WH) {
+       } else if (lyxsize_kind == InsetGraphicsParams::WH) {
                if (!lyxwidth.zero())
                        pars.width  = lyxwidth.inPixels(1, 1);
                if (!lyxheight.zero())
Index: src/insets/insetgraphicsParams.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphicsParams.h,v
retrieving revision 1.21
diff -u -r1.21 insetgraphicsParams.h
--- src/insets/insetgraphicsParams.h    28 May 2002 12:03:42 -0000      1.21
+++ src/insets/insetgraphicsParams.h    24 Jun 2002 07:58:05 -0000
@@ -37,10 +37,10 @@
            NONE                // only keep a frame in place.
        };
        ///
-       enum sizeType {         // for latex and/or lyx
+       enum sizeKind {         // for latex and/or lyx
            DEFAULT_SIZE,       // like none
-           WH,                 // width/height values
-           SCALE               // percentage value
+           SCALE,              // percentage value
+           WH                  // width/height values
        };
        /// Image filename.
        string filename;
@@ -63,7 +63,7 @@
        /// The bounding box with "xLB yLB yRT yRT ", divided by a space!
        string bb;
        /// Type of rescaling
-       sizeType size_type;
+       sizeKind size_kind;
        /// three possible values for rescaling (latex)
        LyXLength width;
        ///
@@ -76,12 +76,14 @@
        string special;
        /// How to display the image inside lyx
        DisplayType display;
-       /// Typ of the LyXView, same as for latex
-       sizeType lyxsize_type;
        /// 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;
        ///
Index: src/support/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.116
diff -u -r1.116 ChangeLog
--- src/support/ChangeLog       20 Jun 2002 20:41:00 -0000      1.116
+++ src/support/ChangeLog       24 Jun 2002 07:58:06 -0000
@@ -1,3 +1,9 @@
+2002-06-20  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * filetools.[Ch]: add new function addExtension(name, ext) to
+       prevent errors when name contains a dot. Then using of
+       ChangeExtension gives an error.
+                       
 2002-06-19  John Levon  <[EMAIL PROTECTED]>
 
        * lyxalgo.h: add eliminate_duplicates
Index: src/support/filetools.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
retrieving revision 1.125
diff -u -r1.125 filetools.C
--- src/support/filetools.C     18 Jun 2002 20:47:49 -0000      1.125
+++ src/support/filetools.C     24 Jun 2002 07:58:06 -0000
@@ -988,6 +988,12 @@
                return string();
 }
 
+/// Return name.ext
+string const addExtension(string const & name, string const & ext)
+{
+       return (name + '.' + ext);
+}
+
 // the different filetypes and what they contain in one of the first lines
 // (dots are any characters).          (Herbert 20020131)
 // AGR Grace...
@@ -995,6 +1001,7 @@
 // EPS %!PS-Adobe-3.0 EPSF...
 // EPSI like EPS and with
 //      %%BeginPreview...
+// FIG #FIG...
 // FITS ...BITPIX...
 // GIF GIF...
 // JPG JFIF
@@ -1056,10 +1063,6 @@
                }
 
                getline(ifs, str);
-
-               lyxerr[Debug::GRAPHICS] << "Scanstring: " << str.substr(0,60)
-                                       << endl;
-
                string const stamp = str.substr(0,2);
                if (firstLine && str.size() >= 2) {
                        // at first we check for a zipped file, because this
@@ -1107,6 +1110,9 @@
                        } else if (prefixIs(str,"%TGIF")) {
                                format =  "tgif";
 
+                       } else if (prefixIs(str,"#FIG")) {
+                               format =  "fig";
+
                        } else if (prefixIs(str,"GIF")) {
                                format =  "gif";
 
@@ -1210,15 +1216,18 @@
 
 string const unzipFile(string const & zipped_file)
 {
-       string const file = ChangeExtension(zipped_file, string());
+       string file = ChangeExtension(zipped_file, string());
+       string const old_ext = GetExtension(file);
+       file = ChangeExtension(file, string()); 
        string  const tempfile = lyx::tempName(string(), file);
+       file = addExtension(tempfile, old_ext);
        // Run gunzip
-       string const command = "gunzip -c " + zipped_file + " > " + tempfile;
+       string const command = "gunzip -c " + zipped_file + " > " + file;
        Systemcall one;
        one.startscript(Systemcall::Wait, command);
        // test that command was executed successfully (anon)
        // yes, please do. (Lgb)
-       return tempfile;
+       return file;
 }
 
 
Index: src/support/filetools.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.h,v
retrieving revision 1.34
diff -u -r1.34 filetools.h
--- src/support/filetools.h     8 Apr 2002 14:55:52 -0000       1.34
+++ src/support/filetools.h     24 Jun 2002 07:58:06 -0000
@@ -141,6 +141,9 @@
 /// Return the type of the file as an extension from contents
 string const getExtFromContents(string const & name);
 
+/// add the ext as an extension to name
+string const addExtension(string const & name, string const & ext);
+
 /// check for zipped file
 bool zippedFile(string const & name);
 

Reply via email to