]> git.lyx.org Git - features.git/blobdiff - src/box.h
various fixes from John, Martin and Kayvan, plus one of mine. Read ChangeLogs
[features.git] / src / box.h
index a42a1b84c6768f4e6d6c8a140655f67d8d793730..60efc7556298d393503c1c309896796dec7f6ac0 100644 (file)
--- a/src/box.h
+++ b/src/box.h
  * It is expected that the box be constructed in
  * normalised form, that is to say : x1,y1 is top-left,
  * x2,y2 is bottom-right.
+ *
+ * Negative values are allowed.
  */
 struct Box {
-       unsigned int x1;
-       unsigned int x2;
-       unsigned int y1;
-       unsigned int y2;
+       int x1;
+       int x2;
+       int y1;
+       int y2;
 
-       Box(unsigned int x1_, unsigned int x2_,
-               unsigned int y1_, unsigned int y2_) :
+       Box(int x1_, int x2_,
+               int y1_, int y2_) :
                x1(x1_), x2(x2_), y1(y1_), y2(y2_) {}
 
        /**
@@ -30,10 +32,18 @@ struct Box {
         * the box. Check is exclusive (point on a border
         * returns false).
         */
-       bool contained(unsigned int x, unsigned int y) {
+       bool contained(int x, int y) {
                return (x1 < x && x2 > x &&
                        y1 < y && y2 > y);
        }
+
+        
 };
  
+inline std::ostream & operator<<(std::ostream & o, Box & b)
+{
+       return o << "x1,y1: " << b.x1 << "," << b.y1
+               << " x2,y2: " << b.x2 << "," << b.y2 << std::endl;
+}
 #endif // BOX_H