]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/GraphicsParams.h
Revert part of 47973dc2b, which was causing bug #11873.
[lyx.git] / src / graphics / GraphicsParams.h
index 1e949d52347efa86c98ede926c7312164293ee09..052b006bff719aa42c1977904be4d2115ec3ea29 100644 (file)
@@ -1,86 +1,85 @@
 // -*- C++ -*-
 /**
- *  \file GraphicsParams.h
- *  Copyright 2002 the LyX Team
- *  Read the file COPYING
+ * \file GraphicsParams.h
+ * 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
  *
- *  Used internally by the GraphicsCache.
- *  Only a subset of InsetGraphicsParams is needed for display purposes.
- *  The GraphicsParams c-tor also interrogates lyxrc to ascertain whether
- *  to display or not.
+ * Full author contact details are available in file CREDITS.
+ *
+ * Used internally by the lyx::graphics::Image.
  */
 
 #ifndef GRAPHICSPARAMS_H
 #define GRAPHICSPARAMS_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
+#include "Length.h"
+
+#include "support/FileName.h"
 
-#include "LString.h"
-#include "lyxlength.h"
+#include <string>
+#include <iosfwd>
 
-class InsetGraphicsParams;
 
-namespace grfx {
+namespace lyx {
+namespace graphics {
 
 /** Parse a string of the form "200pt 500pt 300mm 5in" into a
  *  usable bounding box.
  */
-struct BoundingBox {
+class BoundingBox {
+public:
        ///
        BoundingBox();
        ///
-       BoundingBox(string const &);
+       BoundingBox(std::string const &);
 
        /// 0 0 0 0 is empty!
        bool empty() const;
 
-       unsigned int xl;
-       unsigned int yb;
-       unsigned int xr;
-       unsigned int yt;
+       Length xl;
+       Length yb;
+       Length xr;
+       Length yt;
 };
 
 bool operator==(BoundingBox const &, BoundingBox const &);
 bool operator!=(BoundingBox const &, BoundingBox const &);
 
-struct GParams
-{
-       GParams(InsetGraphicsParams const &, string const & = string());
+/// output bounding box in LyX file format
+std::ostream & operator<<(std::ostream &, BoundingBox const &);
 
-       /// How is the image to be displayed on the LyX screen?
-       enum DisplayType {
-               COLOR,
-               GRAYSCALE,
-               MONOCHROME,
-               /// We aren't going to display it at all!
-               NONE
-       };
 
-       DisplayType display;
+class Params
+{
+public:
+       Params();
+
+       bool display;
+       unsigned int scale;
+       double pixel_ratio;
 
        /// The image filename.
-       string filename;
+       support::FileName filename;
 
+       /** Note that the BoundingBox is always relative to the BoundingBox
+        *  as stored in the EPS file.
+        *  Ie, bb.xl and bb.yb == 0 if that corner is not moved.
+        */
        BoundingBox bb;
 
        /** The size of the view inside lyx in pixels or the scaling of the
         *  image.
         */
-       unsigned int width;
-       unsigned int height;
-       unsigned int scale;
-
        /// Rotation angle.
-       int angle;
+       double angle;
 };
 
-bool operator==(GParams const &, GParams const &);
-bool operator!=(GParams const &, GParams const &);
+bool operator==(Params const &, Params const &);
+bool operator!=(Params const &, Params const &);
 
-} // namespace grfx
+} // namespace graphics
+} // namespace lyx
 
 #endif // GRAPHICSPARAMS_H