]> git.lyx.org Git - lyx.git/blobdiff - src/lyxlength.C
don't copy if a reference is fine
[lyx.git] / src / lyxlength.C
index 2cc2e853b2cc3b5720e74a9b23518849a79c23e7..1ae1de20986383cfded8dd10286ae487e3efe00c 100644 (file)
@@ -17,8 +17,6 @@
 #include "lyxlength.h"
 #include "lengthcommon.h"
 #include "lyxrc.h"
-#include "BufferView.h"
-#include "lyxtext.h"
 
 #include "Lsstream.h"
 
@@ -61,13 +59,16 @@ string const LyXLength::asLatexString() const
        ostringstream buffer;
        switch(unit_) {
        case PW:
+           buffer << abs(static_cast<int>(val_/100)) << "."
+                  << abs(static_cast<int>(val_)%100) << "\\textwidth";
+           break;
        case PE:
            buffer << abs(static_cast<int>(val_/100)) << "."
                   << abs(static_cast<int>(val_)%100) << "\\columnwidth";
            break;
        case PP:
            buffer << abs(static_cast<int>(val_/100)) << "."
-                  << abs(static_cast<int>(val_)%100) << "\\pagewidth";
+                  << abs(static_cast<int>(val_)%100) << "\\paperwidth";
            break;
        case PL:
            buffer << abs(static_cast<int>(val_/100)) << "."
@@ -111,12 +112,8 @@ bool LyXLength::zero() const
 }
 
 
-int LyXLength::inPixels(BufferView const * bv) const
+int LyXLength::inPixels(int default_width, int default_height) const
 {
-       // Height of a normal line in pixels (zoom factor considered)
-       int height = bv->text->defaultHeight(); // [pixels]
-       int default_width  = bv->workWidth();
-
        // Zoom factor specified by user in percent
        double const zoom = lyxrc.zoom / 100.0; // [percent]
 
@@ -179,15 +176,15 @@ int LyXLength::inPixels(BufferView const * bv) const
                break;
        case LyXLength::EX:
                // Ex: The height of an "x"
-               result = zoom * val_ * height / 2; // what to / width?
+               result = zoom * val_ * default_height / 2; // what to / width?
                break;
        case LyXLength::EM: // what to / width?
                // Em: The width of an "m"
-               result = zoom * val_ * height / 2; // Why 2?
+               result = zoom * val_ * default_height / 2; // Why 2?
                break;
        case LyXLength::MU: // This is probably only allowed in
                // math mode
-               result = zoom * val_ * height;
+               result = zoom * val_ * default_height;
                break;
        case LyXLength::PW: // Always % of workarea
        case LyXLength::PE: