Rod Pinna wrote:

> 
> Just opened a file of mine, from 1.1.6fix4, which has a number of
> non-floating eps files. The output from latex has these is incorrectly
> sized. The graphics are scaled to a percentage of the paper width.
> 
> 
> Actually, I see, the new version has a "text%" option, which seems to
> match the output of the previous "% of page" option.
> 
> Not sure if I should call it a bug then...possibly the import should
> convert the 1.1.6 page width to the 1.2.0 text width.


Rod, please try this patch

Herbert



-- 
http://www.lyx.org/help/
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.714
diff -u -r1.714 ChangeLog
--- src/ChangeLog       15 May 2002 23:49:06 -0000      1.714
+++ src/ChangeLog       16 May 2002 19:18:04 -0000
@@ -1,3 +1,11 @@
+2002-05-17  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * lengthcommon.C:
+       * lyxlength.[Ch]: add the forgotten vertical relative Lengths
+       pheight (paperheight) and theight (textheight). The short form
+       is to prevent crashes in fact of the static choice-width in
+       some GUI's.
+
 2002-05-15  John Levon  <[EMAIL PROTECTED]>
 
        * BufferView_pimpl.C:
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  16 May 2002 19:18:04 -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%",     // width units
+       "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.15
diff -u -r1.15 lyxlength.C
--- src/lyxlength.C     11 Apr 2002 18:36:18 -0000      1.15
+++ src/lyxlength.C     16 May 2002 19:18:04 -0000
@@ -46,7 +46,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%");
@@ -112,6 +113,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;
@@ -229,6 +238,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     16 May 2002 19:18:04 -0000
@@ -37,9 +37,11 @@
                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
-               PP, ///< Percent of pagewidth
+               PE, ///< FIXME                          // ???? Herbert
+               PP, ///< Percent of paperwidth
                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/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.382
diff -u -r1.382 ChangeLog
--- src/frontends/xforms/ChangeLog      15 May 2002 23:33:40 -0000      1.382
+++ src/frontends/xforms/ChangeLog      16 May 2002 19:18:06 -0000
@@ -1,3 +1,12 @@
+2002-05-17  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * FormGraphics.C: change a comment-text
+       
+       * xforms_helpers.h: add the forgotten vertical relative Lengths
+       pheight (paperheight) and theight (textheight). The short form
+       is to prevent crashes in fact of the static choice-width in
+       some GUI's.
+
 2002-05-15  John Levon  <[EMAIL PROTECTED]>
 
        * FormCharacter.C: avoid mis-treating Combox as FL_OBJECT
Index: src/frontends/xforms/FormGraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormGraphics.C,v
retrieving revision 1.71
diff -u -r1.71 FormGraphics.C
--- src/frontends/xforms/FormGraphics.C 2 May 2002 08:48:41 -0000       1.71
+++ src/frontends/xforms/FormGraphics.C 16 May 2002 19:18:06 -0000
@@ -545,7 +545,7 @@
        } 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 =
Index: src/frontends/xforms/xforms_helpers.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/xforms_helpers.h,v
retrieving revision 1.24
diff -u -r1.24 xforms_helpers.h
--- src/frontends/xforms/xforms_helpers.h       1 May 2002 09:25:51 -0000       1.24
+++ src/frontends/xforms/xforms_helpers.h       16 May 2002 19:18:06 -0000
@@ -26,7 +26,8 @@
 
 // what we always need for lengths
 string const choice_Length_All =
-    "cm|mm|in|text%%|col%%|page%%|line%%|ex|em|pt|sp|bp|dd|pc|cc|mu";
+    "cm|mm|in|text%%|col%%|page%%|line%%|theight%%|pheight%%"
+    "|ex|em|pt|sp|bp|dd|pc|cc|mu";
 string const choice_Length_WithUnit =
     "cm|mm|in|ex|em|pt|sp|bp|dd|pc|cc|mu";     // all with a Unit
 
Index: src/insets/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.422
diff -u -r1.422 ChangeLog
--- src/insets/ChangeLog        15 May 2002 23:49:07 -0000      1.422
+++ src/insets/ChangeLog        16 May 2002 19:18:08 -0000
@@ -1,3 +1,10 @@
+2002-05-17  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * insetgraphics.C: add the forgotten vertical relative Lengths
+       pheight (paperheight) and theight (textheight). The short form
+       is to prevent crashes in fact of the static choice-width in
+       some GUI's.
+
 2002-05-15  John Levon  <[EMAIL PROTECTED]>
 
        * insettext.C: clear selection on paste (bug 393) 
Index: src/insets/insetgraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.109
diff -u -r1.109 insetgraphics.C
--- src/insets/insetgraphics.C  14 May 2002 09:19:05 -0000      1.109
+++ src/insets/insetgraphics.C  16 May 2002 19:18:08 -0000
@@ -123,10 +123,6 @@
        return ChangeExtension(filename, string());
 }
 
-} // namespace anon
-
-
-namespace {
 
 string const unique_id()
 {
@@ -441,8 +437,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")
@@ -507,7 +505,12 @@
                                params_.scale = lex.getInteger();
                                params_.size_type = InsetGraphicsParams::SCALE;
                            } else {
-                               params_.width = LyXLength(lex.getString()+oldUnits[i]);
+                               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_type = InsetGraphicsParams::WH;
                            }
                        }
@@ -516,8 +519,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_type = InsetGraphicsParams::WH;
                        }
                    }
                }
@@ -634,8 +642,8 @@
        // original file. 
        // to allow files with the same name in different dirs
        // we manipulate the original file "any.dir/file.ext" 
-       // to "any_dir_file.ext"! changing the dots in the  
-       // dirname is important for the use of ChangeExtension
+       // to "any_dir_file.ext"!
+       // changing the dot is important for the use of ChangeExtension
        string temp_file(orig_file);
        if (lyxrc.use_tempdir) {
                string const ext_tmp = GetExtension(orig_file);

Reply via email to