]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/GraphicsParams.C
add <string> and other small fixes to make
[lyx.git] / src / graphics / GraphicsParams.C
index 1f7dfc9d5e4b7cd78d1cc2599368b52bb3f70861..f9317fed70dfaffb9a38dbe67b6f0f8ec3cc5fe1 100644 (file)
@@ -1,51 +1,59 @@
-/*
+/**
  * \file GraphicsParams.C
- * Copyright 2002 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * \author Angus Leeming <a.leeming@ic.ac.uk>
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include "GraphicsParams.h"
-#include "Lsstream.h"
+
 #include "lyxlength.h"
 
+#include "support/std_sstream.h"
+
+
+using std::string;
+using std::abs;
 
-namespace grfx {
 
-GParams::GParams()
+namespace lyx {
+namespace graphics {
+
+Params::Params()
        : display(ColorDisplay),
-         width(0),
-         height(0),
-         scale(0),
+         scale(100),
          angle(0)
 {}
 
 
-bool operator==(GParams const & a, GParams const & b)
+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.angle    == b.angle);
+               a.display == b.display &&
+               a.bb == b.bb &&
+               a.scale == b.scale &&
+               a.angle == b.angle);
 }
 
 
-bool operator!=(GParams const & a, GParams const & b)
+bool operator!=(Params const & a, Params const & b)
 {
        return !(a == b);
 }
 
 
+std::ostream & operator<<(std::ostream & os, BoundingBox const & bb)
+{
+       os << bb.xl << ' ' << bb.yb << ' ' << bb.xr << ' ' << bb.yt;
+       return os;
+}
+
+
 BoundingBox::BoundingBox()
        : xl(0), yb(0), xr(0), yt(0)
 {}
@@ -63,10 +71,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 = LyXLength(a).inBP();
-       int const yb_tmp = LyXLength(b).inBP();
-       int const xr_tmp = LyXLength(c).inBP();
-       int const yt_tmp = 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;
@@ -98,4 +106,5 @@ bool operator!=(BoundingBox const & a, BoundingBox const & b)
        return !(a == b);
 }
 
-} // namespace grfx
+} // namespace graphics
+} // namespace lyx