]> git.lyx.org Git - lyx.git/blob - src/graphics/GraphicsParams.h
3d502f57fc54651643f9ffc7f9044a5345303a2b
[lyx.git] / src / graphics / GraphicsParams.h
1 // -*- C++ -*-
2 /**
3  *  \file GraphicsParams.h
4  *  Copyright 2002 the LyX Team
5  *  Read the file COPYING
6  *
7  *  \author Angus Leeming <a.leeming@ic.ac.uk>
8  *
9  *  Used internally by the GraphicsCache.
10  *  Only a subset of InsetGraphicsParams is needed for display purposes.
11  *  The GraphicsParams c-tor also interrogates lyxrc to ascertain whether
12  *  to display or not.
13  */
14
15 #ifndef GRAPHICSPARAMS_H
16 #define GRAPHICSPARAMS_H
17
18 #ifdef __GNUG__
19 #pragma interface
20 #endif
21
22 #include "LString.h"
23 #include "lyxlength.h"
24
25
26 namespace grfx {
27
28 /** Parse a string of the form "200pt 500pt 300mm 5in" into a
29  *  usable bounding box.
30  */
31 struct BoundingBox {
32         ///
33         BoundingBox();
34         ///
35         BoundingBox(string const &);
36
37         /// 0 0 0 0 is empty!
38         bool empty() const;
39
40         int xl;
41         int yb;
42         int xr;
43         int yt;
44 };
45
46 bool operator==(BoundingBox const &, BoundingBox const &);
47 bool operator!=(BoundingBox const &, BoundingBox const &);
48
49 struct GParams
50 {
51         GParams();
52
53         /// How is the image to be displayed on the LyX screen?
54         enum DisplayType {
55                 COLOR,
56                 GRAYSCALE,
57                 MONOCHROME,
58                 /// We aren't going to display it at all!
59                 NONE
60         };
61
62         DisplayType display;
63
64         /// The image filename.
65         string filename;
66
67         /** Note that the BoundingBox is always relative to the BoundingBox
68          *  as stored in the EPS file.
69          *  Ie, bb.xl and bb.yb == 0 if that corner is not moved.
70          */
71         BoundingBox bb;
72
73         /** The size of the view inside lyx in pixels or the scaling of the
74          *  image.
75          */
76         unsigned int width;
77         unsigned int height;
78         unsigned int scale;
79
80         /// Rotation angle.
81         int angle;
82 };
83
84 bool operator==(GParams const &, GParams const &);
85 bool operator!=(GParams const &, GParams const &);
86
87 } // namespace grfx
88
89 #endif // GRAPHICSPARAMS_H